Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

Searching for string in all tables?

I'd like to loop through all tables in a database searching for a particular string.  The column this string might be in isn't known ahead of time.   Basically, this is a blind search.
0
brettr
Asked:
brettr
  • 2
  • 2
1 Solution
 
chapmandewCommented:
0
 
brettrAuthor Commented:
Thanks.  It doesn't give the column name.  Just its type.  How do I get it to display the column and table name?

Also, I can only run it once and then get the error

There is already an object named '#Results' in the database.

I have tried
Delete #Results

and disconnecting/reconnecting with no luck.
0
 
chapmandewCommented:
try
drop table #results instead...

also, at the very end, instead of this:

SELECT ColumnName, ColumnValue FROM #Results

do this:

select * from #Results
0
 
brettrAuthor Commented:
There's only two columns in #Results.  The ColumnName is still giving [dbo].[StringTable].[String].
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now