May 23, 2005 at 6:53 am
Dear all,
I have a table COLOR with an obsolete column CODE NVARCHAR(8) DEFAULT '' (Empty String). When I want to drop the column I receive the error: Server: Msg 5074, Level 16, State 1, Line 1
The object 'DF__COLOR__CODE__13D789BB' is dependent on column 'code'.
Question: where can I find this objects in the systables in order to write a script to remove this object?
Gerald
May 23, 2005 at 7:48 am
I couldn't find this from the information_schema views, so I resorted to:
select sot.[name] as 'Table Name',
sc.[name] as 'Column name',
sod.[name] as 'Default Name'
from sysobjects sot
inner join
syscolumns sc
on sot.[id] = sc.[id]
inner join
sysobjects sod
on sc.cdefault = sod.[id]
where sod.xtype = 'd'
and sot.xtype = 'U'
Hope it helps
May 23, 2005 at 8:15 am
The DEFAULT value can be found when you open the table in EM. Just DELETE the DEFAULT from the column and you should be good to go.
Good Hunting!
AJ Ahrens
webmaster@kritter.net
May 24, 2005 at 1:06 am
Thank you Wanderer, the SQL statement was exactly what I needed!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply