1:获取某表的列名
select 列名=name from syscolumns where id=object_id(表名')
2:获取数据库表中的表名
select 表名=name from sysobjects where objectproperty(id, 'isusertable ')=1
3:获取数据库表中的列名、字段类型、字段长度
select o.name as tbname, c.name as columnname, (case t.name when 'int' then '数字类型'
when 'datetime' then '时间类型' when 'varchar' then '字符类型' end ) 字段类型,
c.max_length from sys.tables as o join sys.columns
as c on o.object_id=c.object_id join sys.types as t
on c.system_type_id=t.system_type_id
where o.name='SmartForms'