获取MSSQL中表名、列名、字段类型、长度 墨蓝 2021-11-26 20:34 234阅读 0赞 ![ContractedBlock.gif][] ![ExpandedBlockStart.gif][] 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 [ContractedBlock.gif]: https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif [ExpandedBlockStart.gif]: /images/20211126/7cdf66d9de654eb48fd9cd7ec97445cb.png
还没有评论,来说两句吧...