【发布时间】:2018-04-28 05:36:36
【问题描述】:
我想找出包含单词“VAP”或取消的列。但问题是我们的服务器中有多个数据库。我想知道哪个数据库/表中包含包含这些单词的列名。谁能告诉我们是否有任何查询可用于从所有数据库中搜索列名?我已经尝试过以下查询,但它只会帮助从单个数据库中查找。
select distinct
t.name as TableName,
SCHEMA_NAME(t.schema_id) as TableSchema,
c.name as ColumnName,
ct.name as ColumnDataType,
c.is_nullable as IsNullable
from
sys.tables t with(nolock)
inner join
sys.columns c with(nolock) on t.object_id = c.object_id
inner join
sys.types ct with(nolock) on ct.system_type_id = c.system_type_id
where
c.name like '%VAP%'
order by
t.name
【问题讨论】:
-
你有多少个数据库?
-
对所有数据库运行相同的查询:stackoverflow.com/questions/18462410/…
标签: sql-server database