Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
cidr
Posting Yak Master
207 Posts |
Posted - 2010-04-14 : 10:41:13
|
Hi there,I don't think this is possible but I thought I'd ask anyway.I have a database with a LOT of tables and to ascertain what table I'm looking for I have to find a certain value within a field in one of the tables. Let's say the value is '0199999'Is there anyway of letting SQL server find a value that matches in one of the fields in the database?I know text can be found by looking in syscomments but finding a particular value is obviously a different request.Any help would be great:) |
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2010-04-14 : 12:07:21
|
You could generate the tests in Management Studio with something like the following. These tests could take a long time to run!SELECT 'IF EXISTS (SELECT * FROM [' + TABLE_SCHEMA + '].[' + TABLE_NAME + '] WITH (NOLOCK) WHERE [' + COLUMN_NAME + '] = ''0199999'') SELECT ''[' + TABLE_SCHEMA + '].[' + TABLE_NAME + '].[' + COLUMN_NAME +']'''FROM INFORMATION_SCHEMA.COLUMNSWHERE DATA_TYPE LIKE '%char' |
 |
|
cidr
Posting Yak Master
207 Posts |
Posted - 2010-04-23 : 05:42:25
|
Thanks for your help with this Ifor.I found other code a while back but yours seems easier to implement.:) |
 |
|
|
|
|