日期:2014-05-17 浏览次数:20573 次
Select name from syscolumns Where ID=OBJECT_ID('表名')
------解决方案--------------------
Select name from syscolumns Where id=object_id('tb'
------解决方案--------------------
select name from syscolumns Where id=object_id('tb')
------解决方案--------------------
--获取表名
1、SELECT name FROM sys.sysobjects WHERE TYPE='U'
2、SELECT name FROM sys.tables WHERE TYPE='U'
3、SELECT name FROM sys.objects WHERE TYPE='U'
--获取表名,字段及类型
SELECT b.name tableName,a.name columnName,c.name typeName FROM sys.columns a
inner join sys.objects b
on a.object_id=b.object_id and b.TYPE='U'
inner join sys.types c
on a.user_type_id=c.user_type_id --and c.name='bit' -- 字段类型
order by a.object_id,column_id