Here’s a script that will find a value in a field. The stored procedure will go through each field in each table of a database and look for a specified value (for example, order number ‘1-ASD-DER-45T’ or similar). The value you are looking for and the data type (varchar, int, etc.) need to be supplied as parameters. The script will then give you the table name, column name, and matching values from the entire database. This stored procedure will work in SQL Server 7.0 and SQL Server 2000.
There are two text files in the ZIP package — sp_check_field_all_db.txt is the stored procedure itself, while find_anything_in_db_by_value is an example of how to use the sp.
Author: Roman Feldblum
Download Script:
sp_findvalue.zip
Disclaimer: We hope that the information on these script pages is
valuable to you. Your use of the information contained in these pages,
however, is at your sole risk. All information on these pages is provided
“as -is”, without any warranty, whether express or implied, of its accuracy,
completeness, or fitness for a particular purpose…
Disclaimer Continued
Back to Database Journal Home