Unbinds (removes) a default from a column or from a user-defined data type in the current database.
sp_unbindefault [@objname =] 'object_name'
[, [@futureonly =] 'futureonly_flag']
Note object_name can contain the [ and ] characters as delimited identifier characters. For more information, see Delimited Identifiers.
0 (success) or 1 (failure)
None
To display the text of a default, execute sp_helptext with the name of the default as the parameter.
When a default is bound to a column, the information about binding is removed from the syscolumns table. When a default is bound to a user-defined data type, the information is removed from the systypes table.
Execute permissions default to the owner of the specified object.
This example unbinds the default from the hiredate column of an employees table.
EXEC sp_unbindefault 'employees.hiredate'
This example unbinds the default from the user-defined data type ssn. It unbinds existing and future columns of that type.
EXEC sp_unbindefault 'ssn'
This example unbinds future uses of the user-defined data type ssn without affecting existing ssn columns.
EXEC sp_unbindefault 'ssn', 'futureonly'
This example shows the use of delimited identifiers in object_name.
CREATE TABLE [t.3] (c1 int) -- Notice the period as part of the table
-- name.
CREATE DEFAULT default2 AS 0
GO
EXEC sp_bindefault 'default2', '[t.3].c1'
-- The object contains two periods;
-- the first is part of the table name and the second
-- distinguishes the table name from the column name.
EXEC sp_unbindefault '[t.3].c1'
CREATE DEFAULT | sp_helptext |
DROP DEFAULT | System Stored Procedures |
sp_bindefault |