sp_unbindrule System Stored Procedure

Unbinds a rule from a column or a user-defined datatype in the current database.

Syntax

sp_unbindrule objname [, futureonly]

where

objname
Specifies the table and column or the user-defined datatype from which the rule is to be unbound. If the parameter is not of the form 'table.column', objname is recognized as a user-defined datatype. When unbinding a rule from a user-defined datatype, any columns of that datatype that have the same rule as the user datatype are also unbound. Columns of that datatype with rules bound directly to them are unaffected.
futureonly
Used only when unbinding a rule from a user-defined datatype, this option prevents existing columns of that datatype from losing this rule. It is never used when unbinding a rule from a column.

Remarks

The rule is unbound from all existing columns of the user-defined datatype unless their default has previously been changed or the futureonly option is used.

To display the text of a rule, execute sp_helptext with the rule name as the parameter.

When you unbind a rule, the information about the binding is removed from the syscolumns table if the rule was bound to a column, and from the systypes table if the rule was bound to a user-defined datatype.

Examples

A.    Unbind a Rule from a Column

This example unbinds the rule from the startdate column of the employees table.

sp_unbindrule 'employees.startdate'
B.    Unbind a Rule from a User-defined Datatype

This example unbinds the rule from the user-defined datatype ssn. It unbinds the rule from existing and future columns of that type.

sp_unbindrule ssn
C.    Use futureonly

This example unbinds the rule from the user-defined datatype ssn without affecting existing ssn columns.

sp_unbindrule ssn, FUTUREONLY

Permission

Execute permission defaults to the object owner.

Tables Used

syscolumns, sysobjects, systypes

See Also

CREATE RULE sp_bindrule
DROP RULE sp_helptext