sqlserver查询某个字段在哪些表中存在

2025-01-01 22:38:53
推荐回答(1个)
回答1:

在sqlserver中查找某个字段存在于那个表中的语句是:

use test
go
select a.Name as tableName from sysobjects a inner join syscolumns b on a.ID=b.ID
where b.Name='列名'

例句:
use DigSmart70FL
go
select a.Name as tableName from sysobjects a inner join syscolumns b
on a.ID=b.ID where b.Name='DtReceived'