Monday, March 12, 2012

Query Entire DB

I need to search all of the tables in a DB for a specific number (say, 123456). I am unsure of which tables may have this number in it. Is there a way to search an entire DB for a specific criteria?

This is what I want:

Select *

From [db]

where [column] like '%123456%'

I understand why this dosen't work (the DB doesn't have column names), but is there a way to display table names where this number exists? If I had that, then I could search the tables individually.

Yes, this can be done. Here is a link where there is a stored procedure that you can use to search for a string in all tables...

http://searchsqlserver.techtarget.com/tip/1,289483,sid87_gci1125053,00.html

|||

This is exactly what I was looking for. Thanks!

Have you used this toward a Microsoft Dynamics company db?

No comments:

Post a Comment