用SQL怎样查询到包含有某个字段的所有表名

2024-12-21 21:07:48
推荐回答(1个)
回答1:

select a.name 表名,b.name 列名 from sysobjects a,syscolumns b where a.id = b.id and b.name = '表名'and a.type='U'
还有一种:
SELECT b.name as TableName,a.name as columnname
From syscolumns a INNER JOIN sysobjects b
ON a.id=b.id
AND b.type=’U’
AND a.name=’你的字段名字’