Several times I have came across with the question that how can I search all columns of all tables in a SQL Server database for a particular value. Unfortunately, you can not perform this query directly by any already provided system table or object.
There are some fundamental points to remember:
- You have to iterate the list of tables and for each table you have to iterate each column and perform an exist query against it.
- You will need three types of queries due to the data types i.e. string, number and date and time.
I have found an excellent article here which provides a good explanation along with the necessary sql script. I would recommend every reader to read this article.
[...] 2008, Search columns — namwar @ 8:50 am Tags: SSMS, Tools In my one of earlier articles here I wrote about a way to find any value in any database column. Today, I found a great free tool, [...]
Pingback by Search anything in your Database schema right from SSMS « SQL Tips by Namwar Rizvi — March 29, 2010 @ 8:50 AM |
[...] my one of earlier articles here I wrote about a way to find any value in any database column. Today, I found a great free tool, [...]
Pingback by Search anything in your Database schema right from SSMS — March 29, 2010 @ 8:54 AM |
I wanted create search system from sql data. How retrive data from multipal table without join. Because No common field in table. I have Many table.
Please help me.
Comment by om prakash — March 30, 2010 @ 6:39 AM |