SQL select查询选择具有特定字段和值的表名 [英] SQL select query to select table name having a particular field and value

查看:776
本文介绍了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)


这篇关于SQL select查询选择具有特定字段和值的表名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆