sql server 中获取字段默认值SQL
2006-09-08 10:00
309 查看
获取所有的默认值列表
select
object_name(c.id) as 表名
,c.name as 字段名
,t.name as 数据类型
,c.prec as 长度
,p.value as 字段说明
,m.text as 默认值
from syscolumns c
inner join
systypes t
on c.xusertype=t.xusertype
left join
sysproperties p
on c.id=p.id and c.colid = p.smallid
left join
syscomments m
on c.cdefault=m.id
研究了很久 终于搞定了
获取单个字段的默认值列表
select
object_name(c.id) as 表名
,c.name as 字段名
,t.name as 数据类型
,c.prec as 长度
,p.value as 字段说明
,m.text as 默认值
from syscolumns c
inner join
systypes t
on c.xusertype=t.xusertype
left join
sysproperties p
on c.id=p.id and c.colid = p.smallid
left join
syscomments m
on c.cdefault=m.id
where objectproperty(c.id,'IsUserTable')=1
and object_name(c.id) = 'T_good' and c.name = 'ishot'
select
object_name(c.id) as 表名
,c.name as 字段名
,t.name as 数据类型
,c.prec as 长度
,p.value as 字段说明
,m.text as 默认值
from syscolumns c
inner join
systypes t
on c.xusertype=t.xusertype
left join
sysproperties p
on c.id=p.id and c.colid = p.smallid
left join
syscomments m
on c.cdefault=m.id
研究了很久 终于搞定了
获取单个字段的默认值列表
select
object_name(c.id) as 表名
,c.name as 字段名
,t.name as 数据类型
,c.prec as 长度
,p.value as 字段说明
,m.text as 默认值
from syscolumns c
inner join
systypes t
on c.xusertype=t.xusertype
left join
sysproperties p
on c.id=p.id and c.colid = p.smallid
left join
syscomments m
on c.cdefault=m.id
where objectproperty(c.id,'IsUserTable')=1
and object_name(c.id) = 'T_good' and c.name = 'ishot'
相关文章推荐
- SQL Server 2008中获取数据库所有表及其字段名称、类型、长度的SQL
- Sql Server获取SQL所有数据库名、所有表名、所有字段名
- Sql Server 获取SQL 所有数据库名、所有表名、所有字段名
- SQL Server 中获取数据库所有表及其字段名称、类型、长度的SQL
- SQL Server 2008中获取数据库所有表及其字段名称、类型、长度的SQL
- 教你如何在 sql server 2005 使用 sql 语句获取字段的说明信息
- SQL语句获取数据表名,字段等信息
- SQL Server 2008获取一个表的字段,类型,长度,是否主键,是否为空,注释等信息
- 找到并罗列出SQL Server中具有默认值的所有字段
- Oracle 获取表带字段备注SQL语句存储过程
- mysql常用sql总结_获取多个字段最大值最小值
- SQL语句修改字段默认值
- [sql server] 获取指定表的创建脚本,包括表和字段的属性、外键(注释掉的)
- SQL修改字段默认值
- SQL获取所有用户名,数据库名、所有表名、所有字段名及字段类型
- SQL SERVER 获取表结构信息的SQL语句
- SQL 2008日期字段默认值设置为当前日期
- 转载Sql 获取数据库所有表及其字段名称,类型,长度
- Sql Server 增加字段、修改字段、修改类型、修改默认值
- SQL语句获取所有数据库名、表名、字段名、表字段长度