查询数据库中所有表名和表中所有字段名

查询数据库中所有表名和表中所有字段名

查询表中所有字段名:

declare @s varchar(1000)
select @s = isnull(@s+',', '') + [name] from syscolumns where id = object_id('表名')
select @s


--select name from sysobjects where type=1 and flags=0


--select name from sysobjects where type='U'

查询数据库中所有表名:

select Name from sysobjects where xtype='u' and status>=0
原文地址:https://www.cnblogs.com/Dageking/p/2975280.html