如何将其应用于来自不同表的多个约束:
IF (OBJECT_ID('DF_Constraint') IS NOT NULL)
BEGIN
ALTER TABLE [dbo].[tableName]
DROP CONSTRAINT DF_Constraint
END
没有像这样为我工作:
IF (OBJECT_ID('DF_Constraint') IS NOT NULL)
AND (OBJECT_ID('DF_Constraint2') IS NOT NULL)
BEGIN
ALTER TABLE [dbo].[tableName] DROP CONSTRAINT DF_Constraint;
ALTER TABLE [dbo].[tableName2] DROP CONSTRAINT DF_Constraint2;
END
尝试这样的事情: