Forum Discussion
I need to find a string in a database without knowing table or field
I have a database that contains approximately 130 tables. It's tied to a proprietary application, and I have no way to find its structure except by reverse engineering.
But I only need to find the table that contains one particular field in the application's UI, so I thought I'd take a shortcut: use Windows Explorer to search the Microsoft SQL Server directory (and children) for a file that contains a string that I know is in the database. I did this, and got zero matches.
I checked how SQL Server stores CHAR and VARCHAR fields. I found that it stores them in UTF-8 encoding. OK, I thought, perhaps Windows Explorer can't find strings encoded in UTF-8. Or perhaps it's programmed to ignore files in the SQL Server folder, like it ignores files in Git repositories.
So I tried searching for the string with Notepad++'s Find in Files function. And again, found nothing.
What is going on here? Is there any way I can search the raw database files without using SQL Server itself? Alternatively, is there some way I can search an entire database for a string without knowing what column or table it is in?
1 Reply
There are may be tools which opens MDF files open directly. The best approach is install SQL Server, Attach Databases using SQL server Management Studio and Use native query tool. Pls check this link
Search and Find String Value in all SQL Server Table Columns