获取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

 

posted @ 2012-05-15 11:27  划破黑夜  阅读(919)  评论(0编辑  收藏  举报