获取MSSQL中表名、列名、字段类型、长度


 

View Code
1 select syscolumns.name AS ColumnName,systypes.name AS TypeName,syscolumns.length as length
2   from syscolumns,sysobjects,systypes where syscolumns.id=sysobjects.id and syscolumns.xtype= systypes.xtype and sysobjects.name= '表名' order by syscolumns.colid
1 select * from sys.all_columns where object_id=(select id from sysobjects where name='表名')
SELECT Name FROM DatabaseName..SysObjects Where XType='U' ORDER BY Name
原文地址:https://www.cnblogs.com/wugang/p/2501212.html