Click here to Skip to main content
15,905,563 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Comments
_Maxxx_ 18-Feb-13 1:25am    
Just to confirm.
You want a list of the names of the tables that have a record with the value 'jquery' in the Name column?
Are these 58 tables the only tables, or if not can they be somehow identified (do all their names start with 'XXX' for example)

HI,


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
 
Share this answer
 
Quick and dirty suggestion..


SQL
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'


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)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900