--读取库中的所有表名
select name from sysobjects where xtype='u'
--读取指定表的所有列名
select name from syscolumns where id=(select max(id) from sysobjects where xtype='u' and name='表名')
select name from sysobjects where xtype='u'
--读取指定表的所有列名
select name from syscolumns where id=(select max(id) from sysobjects where xtype='u' and name='表名')
本文介绍如何使用SQL语句来查询数据库中所有的表名及指定表的所有列名。通过两个简单的SQL脚本,可以轻松获取这些元数据信息。
4954

被折叠的 条评论
为什么被折叠?



