ALTER TABLE TableName <CHECK / NOCHECK> CONSTRAINT ConstraintName
GO
Examples:
--disable constraint
ALTER TABLE dbo.StamTable2 NOCHECK CONSTRAINT StamTable2_check
GO
--enable constraint
ALTER TABLE dbo.StamTable2 CHECK CONSTRAINT StamTable2_check
GO
--disable all constraints for the dbo.StamTable2 table
ALTER TABLE dbo.StamTable2 NOCHECK CONSTRAINT ALL
GO
--enable all constraints for the dbo.StamTable2 table
ALTER TABLE dbo.StamTable2 CHECK CONSTRAINT ALL
GO
NOTE: This action applies only to foreign key and check constraints.
No comments:
Post a Comment