July 3, 2012 at 6:52 am
I recently wrote the following generator script because I did not know of a simplier way to find the table/column that held a particular value. Does anyone know a better way?
SELECT 'select * from ' + TABLE_NAME + ' where LOWER([' + column_name + ']) = ''family_data.txt'''
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name NOT LIKE '%_backup'
AND table_name NOT LIKE 'gen%'
Thanks.
<><
Livin' down on the cube farm. Left, left, then a right.
July 3, 2012 at 6:58 am
Tobar take a look at this thread, or search for "sp_UGLYSEARCH" (with quotes)
http://www.sqlservercentral.com/Forums/Topic1221552-1292-1.aspx
that's a proc i wrote to do exactly what you are asking: find specific values in a database, where you don't know the table or column name.
Lowell
July 3, 2012 at 7:47 am
Thanks
<><
Livin' down on the cube farm. Left, left, then a right.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply