select d.name,a.name ,b.name ,a.length, a.isnullable from syscolumns a, systypes b,sysobjects d where a.xtype=b.xusertype and a.id=d.id and d.xtype='U'
解决方案 »
- 求Microsoft.SQL.Server.2005(ALL) 简体中文版(DVD)下载地址
- 郁闷的查询,每一组拿一条
- <Long Text> 添加数据的时候
- 特殊点的行转列问题,请求帮助
- MSSQL群,欢迎大家加入4441311
- 如何用程序传一个SQl语句,让存储过程执行??
- 这样的数据库系统是如何设计的
- 我怎样写这条sql语句呢?
- 在SQL Server2000,怎么从一个datetime类型(如2001-09-12 10:12:50)中计算离现在多少天?
- 求助,一个菜鸟的问题!
- 各位大虾,有关sqlserver7.0升级到sqlserver2000的问题!在线等候!
- 存储过程中有关事务与锁的问题
,case when h.id is not null then 'PK' else '' end as primarykey
,type_name(b.xusertype) + case when b.colstat & 1 = 1 then '[ID(' + convert(varchar,ident_seed(a.name)) + ',' + convert(varchar,ident_incr(a.name)) + ')]' else '' end as type
,b.length
,case b.isnullable when 0 then 'N' else 'Y' end as [isnull]
,isnull(e.text,'') as [default]
,isnull(c.value,'') as descript
from sysobjects a,syscolumns b
left outer join sysproperties c on b.id = c.id and b.colid = c.smallid
left outer join syscomments e on b.cdefault = e.id
left outer join (select g.id,g.colid from sysindexes f,sysindexkeys g where f.id = g.id and f.indid = g.indid and f.indid > 0 and f.indid < 255 and (f.status & 2048)<>0) h on b.id = h.id and b.colid = h.colid
where a.id = b.id
and a.id = object_id('titles') --tablename改成你要导出的表的名称
order by b.colid
不过‘是否字段值必须唯一’这一项没有提供啊。