当前位置: 代码迷 >> Sql Server >> 怎么找出字段默认值名称
  详细解决方案

怎么找出字段默认值名称

热度:25   发布时间:2016-04-27 19:51:34.0
如何找出字段默认值名称?
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)
  相关解决方案