Drop a default constraint without knowing the name
Posted by scmay on January 6, 2009
This is a very nice script written by Rob Farley
declare @table_name nvarchar(256)
declare @col_name nvarchar(256)
set @table_name = N’Department’
set @col_name = N’ModifiedDate’select t.name, c.name, d.name, d.definition
from sys.tables t
join
sys.default_constraints d
on d.parent_object_id = t.object_id
join
sys.columns c
on c.object_id = t.object_id
and c.column_id = d.parent_column_id
where t.name = @table_name
and c.name = @col_name


Xian said
Good find Joyce
Of course the script above only finds it’s name, but it would be easy enough to modify it