tsql add default constraint
IF NOT EXISTS(select * from sys.DEFAULT_CONSTRAINTS where NAME like 'def_myconstraint1%')
BEGIN
ALTER TABLE mytable1
ADD CONSTRAINT def_myconstraint1 DEFAULT 1 FOR mycolumn1
END
GO
Achievement provides the only real pleasure in life
IF NOT EXISTS(select * from sys.DEFAULT_CONSTRAINTS where NAME like 'def_myconstraint1%')
BEGIN
ALTER TABLE mytable1
ADD CONSTRAINT def_myconstraint1 DEFAULT 1 FOR mycolumn1
END
GO
Posted by SF at 2:32 pm
No comments:
Post a Comment