日期:2014-05-18  浏览次数:20507 次

如何找出字段默认值名称?
select   name   as   dropname   from   sysobjects   where   xtype= 'D '   and   parent_obj=(select   id   from   sysobjects   where   name= 'table_name '   and   xtype= 'U ')   and   id   in   (select   cdefault   from   syscolumns   where   name= 'column_nane ')

我是这样写的,执行结果没问题,大家有没有更好的方法?

------解决方案--------------------
select name as dropname from sysobjects where xtype= 'D ' and id=(select cdefault from syscolumns where name= 'column_nane ' and object_id( 'tablename ')=id)