select a.name as colNm,a.id as colId,b.name as tabNm,b.id as tabId
from syscolumns a, sysobjects b
where a.id=b.id and b.xtype='U' and a.name in ('指定字段一','指定字段一')
注解:
select * from syscolumns where id=object_id('表名')
以上是检索表名的所有字段的名称
select * from sysobjects where xtype='U' and category=0
以上是检索相应用户表的方法
对于本问题的要求中更简单的处理方式是:
select table_name,column_name,data_type
from information_schema.columns
where column_name in ('指定字段一','指定字段一')