Tag Info

New answers tagged

2

The problem is similar to this one: How to have a one-to-many relationship with a privileged child? The "at most one per group" part of the constraint can be solved with a partial index: CREATE UNIQUE INDEX is_FavoriteChild ON x (yid) WHERE is_principal ; Another way to solve the problem is by removing the is_principal column and add a 3rd table. ...


-2

Drop Index and Reccreate it did the trick for me.


2

What you could do is disable the constraints on the table instead of dropping them, and then re-enable them once done. For SQL Server: -- Disable all the constraint in database EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all" -- Enable all the constraint in database EXEC sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"



Top 50 recent answers are included