-- Disable the specified name trigger ALTER TABLE Tbname DISABLE TRIGGER trigname-- Restore the specified name trigger ALTER TABLE Tbname ENABLE TRIGGER trigname ----enable all triggers on a table ALTER TABLE Tbname enable TRIGGER all
--Disable all triggers on all tables
exec sp_msforeachtable ' ALTER TABLE? DISABLE TRIGGER All '
--Enable all triggers on all tables
exec sp_msforeachtable ' ALTER TABLE? Enable TRIGGER all '
-- Add primary key ALTER TABLE TBNAME ADD constraint Pk_name primary key (COLUMN1,COLUMN2)-- add nonclustered primary key ALTER TABLE Tbname add Constraint Pk_name primary key nonclustered (COLUMN1,COLUMN2)-- Delete primary key ALTER TABLE tbname DROP constraint Pk_name
-- Add foreign key ALTER TABLE TBNAME ADD constraint fk_name foreign key (fk_column) references Pk_tbname (pk_column)-- Delete foreign key ALTER TABLE tbname drop constraint fk_name
-- Enable or disable all foreign KEY constraints on the specified table ALTER TABLE tbname NOCHECK constraint all alter TABLE tbname CHECK constraint All-- view constraints Select from Sys.foreign_keys order by name
--Add UNIQUE constraints
ALTER TABLE TBNAME add constraint uq_colname unique (colname)
SQL Server disables enabling triggers, FOREIGN KEY constraints