Skip to main content
 首页 » 数据库

查出所有字段默认值的相关信息

2022年09月29日103jyk

--以系统自带pubs数据库为例.这个语句可以查出所有默认值的相关信息.
----htl258(Tony) 2009/04/16 02:53

select
    (select name from sysobjects where id=c.id) 表名,
    (select name from syscolumns where cdefault=a.id) 字段名,
    b.name 默认值名,
    a.[text] 默认值
from 
    syscomments a,
    sysobjects b,
    syscolumns c
where b.xtype='d'
    and a.id=b.id
    and b.parent_obj=c.id
    and a.colid=c.colid


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/htl258/archive/2009/04/16/4082804.aspx


本文参考链接:https://blog.csdn.net/faunjoe/article/details/4358856