sp_unbindrule (Transact-SQL)
Unbinds a rule from a column or 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. |
To display the text of a rule, execute sp_helptext with the rule name as the parameter.
When a rule is unbound, the information about the binding is removed from the sys.columns table if the rule was bound to a column, and from the sys.types table if the rule was bound to an alias data type.
When a rule is unbound from an alias data type, it is also unbound from any columns having that alias data type. The rule may also still be bound to columns whose data types were later changed by the ALTER COLUMN clause of an ALTER TABLE statement, you must specifically unbind the rule from these columns by using sp_unbindrule and specifying the column name.
A. Unbinding a rule from a column
The following example unbinds the rule from the startdate column of an employees table.
EXEC sp_unbindrule 'employees.startdate'
B. Unbinding a rule from an alias data type
The following example unbinds the rule from the alias data type ssn. It unbinds the rule from existing and future columns of that type.
EXEC sp_unbindrule ssn
C. Using futureonly_flag
The following example unbinds the rule from the alias data type ssn without affecting existing ssn columns.
EXEC sp_unbindrule 'ssn', 'futureonly'
D. Using delimited identifiers
The following example shows using delimited identifiers in the object_name parameter.
CREATE TABLE [t.4] (c1 int) -- Notice the period as part of the table -- name. GO CREATE RULE rule2 AS @value > 100 GO EXEC sp_bindrule rule2, '[t.4].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. GO EXEC sp_unbindrule '[t.4].c1'
Important