sp_unbindefault (Transact-SQL)
Unbinds, or removes, a default from a column or from an alias data type in the current database.
Important |
|---|
This feature will be removed in the next version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible. We recommend that you create default definitions by using the DEFAULT keyword in the ALTER TABLE or CREATE TABLE statements instead. For more information, see Creating and Modifying DEFAULT Definitions. |
A. Unbinding a default from a column
The following example unbinds the default from the hiredate column of an employees table.
EXEC sp_unbindefault 'employees.hiredate'
B. Unbinding a default from an alias data type
The following example unbinds the default from the alias data type ssn. It unbinds existing and future columns of that type.
EXEC sp_unbindefault 'ssn'
C. Using the futureonly_flag
The following example unbinds future uses of the alias data type ssn without affecting existing ssn columns.
EXEC sp_unbindefault 'ssn', 'futureonly'
D. Using delimited identifiers
The following example shows using delimited identifiers in object_name parameter.
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'
Important