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

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

 

查询表中所有字段名:

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

 

posted @ 2013-03-22 12:43  DageKing  阅读(466)  评论(0编辑  收藏  举报