SQL select查询选择具有特定字段和值的表名

问题描述:

您好b $ b

我有58张桌子在同一个数据库中拥有相同的字段,





如何才能在名称字段中具有特定值的表名?







例如:



它应该在name字段中显示所有具有值jquery的表名

Hi
I have 58 tables having the same field in a single DB,


how can i fine the table names which has the particular value in name field??



Example:

it should display all the table name having the value "jquery" in "name" field

HI,





查看以下链接



在所有列中搜索并查找字符串值在SQL Server表 [ ^ ]





喜欢这个U必须很棒SP和支票



:-)



问候,>
GVPrabu



Check the following link

Searching and finding a string value in all columns in a SQL Server table[^]


Like this U have to great one SP and Check

:-)

Regards,
GVPrabu


快速和肮脏的建议..





Quick and dirty suggestion..


Select * from
(Select Name , 'TableA' as TableName from TableA
union
Select Name , 'TableB' as TableName from TableB
union
Select Name , 'TableC' as TableName from TableC)

where Name = 'JQuery'





如果这对您有用,您可以随时创建av离开联盟并从中选择(假设这不是一次性请求)



If this works for you you could always create a view out of the Union and select from that (assuming this isn''t a one-off request)