SELECT d.name ‘TABLE_NAME‘,f.value as ‘TABLE_COMMENT‘,a.[name] as ‘COLUMN_NAME‘,a.length ‘长度‘,c.[name] ‘DATA_TYPE‘,e.value as ‘COLUMN_COMMENT‘,
COLUMNPROPERTY(a.id,a.name,‘IsIdentity‘) as ‘COLUMN_IDENTITY‘,
case when exists(SELECT 1 FROM sysobjects where xtype=‘PK‘and name in (SELECT name
FROM sysindexes WHERE indid in(SELECT indid FROM sysindexkeys
WHERE id = a.id AND colid=a.colid ))) then 1 else 0 end as ‘COLUMN_PRIMARYKEY‘
FROM syscolumns a left join systypes b on a.xusertype=b.xusertype
left join systypes c on a.xtype = c.xusertype
inner join sysobjects d on a.id=d.id and d.xtype=‘U‘
left join sys.extended_properties e on a.id = e.major_id and a.colid = e.minor_id and e.name=‘MS_Description‘
left join sys.extended_properties f on d.id = f.major_id and f.minor_id=0 and e.name=‘MS_Description‘
相关文章
- 09-25sqlserver 字段长度大于数据库表字段或者内存表与数据库表字段不匹配提示
- 09-25查询某个数据库下所有用户数据表名及各数据表字段信息
- 09-25sqlserver 查询表中所有字段的最大长度(转载)
- 09-25SqlServer判断数据库、表、字段、存储过程、函数是否存在
- 09-25Orcla 数据库复习2 --子查询和表连接
- 09-25SQLSERVER如何获取一个数据库中的所有表的名称、一个表中所有字段的名称
- 09-25sqlserver查询数据的所有表名和行数
- 09-25sqlserver查看数据库下所有表的自增列
- 09-25sqlserver查询数据的所有表名和行数
- 09-25Orcle数据库查询当前用户有表、表说明、表字段、字段说明