Information générale
Forum:
Microsoft SQL Server
>A true constraint is owned by a single table but can affect multiple columns. For instance, I can have a PRIMARY KEY constriant for column1 and column2:
>
>CONSTRAINT name PRIMARY KEY (column1, column2)
>
>But a default constraint is applicable to only one column.
>
>I haven't been able to determine an easy way to identify DEFAULT constraints. It appears that none of the INFORMATION_SCHEMA views reveals that information, and SQL-DMO doesn't either. I think you'll either have to hit the system tables directly or use sp_helpconstraints.
>
>-Mike
We have several bit fields which use the same (user defined) default constraint.
We found that sp_unbinddefault will remove the default constraint from a column without dropping the constraint.
For the time being, at least, I will have to access all tables in the database upfront, collecting sp_helpconstraints data into a VFP cursor. Then, check my cursor to determine if this is the only column to use the constraint. If it is, the constraint will be dropped. Otherwise, I will just unbind it.
Thanks, Brett
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement