Networking AND WWW

Networks, Systems, security & websites solutions

Wednesday, October 12, 2005

SQL SP to search for string in all tables in a DB

When working on SQL databases, from time to time you feel the need to search for a integer / string in all the tables of a databses. While there are queries written by many but I found this one handy.

http://tinyurl.com/7c2ho

I wanted to search for a string while I was working on MS Project server database in production. This query solved my purpose.

1. Run the script (go to url above) in Query Analyzer for the database in which you want to search for a integer / string

2. Use the syntax mentioned or try one in the examples section to search for integer / string
3. View the results by querying the ##tmpSearchResult table

(Imp: Play with the script in your testing environment then use in production. Use it at your own risk.)

AddThis Social Bookmark Button