获取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/archive/2012/05/15/2501212.html

你可能感兴趣的:(获取MSSQL中表名、列名、字段类型、长度)