How To search entire database?
- Get link
- X
- Other Apps
While browsing the SQL Server newsgroups, there are occasional requests for a script capable of searching all the columns of all the tables in a given database for a specific keyword. Although it might seem trivial, the need for such a script became apparent in a real-world scenario.
In troubleshooting a problem with Microsoft Operations Manager (MOM), which utilizes SQL Server for storing computer, alert, and performance-related information, a network administrator needed to search all the MOM tables for a specific string. Lacking a readily available script, manual searching ensued. This experience prompted the creation of a stored procedure called “SearchAllTables.”
SearchAllTables Stored Procedure
The SearchAllTables
stored procedure takes a search string as an input parameter and systematically searches all char
, varchar
, nchar
, and nvarchar
columns of all tables (excluding system tables) owned by all users in the current database. Feel free to extend this procedure to search for other data types.
For more details and the script, you can check out the following links:
This script proves handy in scenarios where a comprehensive search across all user-created tables is necessary, facilitating efficient troubleshooting and data exploration.
- Get link
- X
- Other Apps
Comments
http://www.SQLLocator.com
http://www.targetmind.com/
http://letslearnssis.blogspot.com