Not that easy in SQL Server idd :(
Best solution would probably be to use a third party tool, like ApexSQL Search (free).
Your script should work, but it will be very slow when running it for a large database.
I did a quick Google search and found you probably got your script from here:
stackoverflow dot com slash questions slash 591853 slash search-for-a-string-in-all-tables-rows-and-columns-of-a-db
The comments in the answer also say it will be "RIDICULOUSLY slow" :)
The answer below that also suggests ApexSQL, or use a script with temporary tables instead of cursors, which will increase the speed significantly.
Not that easy in SQL Server idd :(
Best solution would probably be to use a third party tool, like ApexSQL Search (free).
Your script should work, but it will be very slow when running it for a large database.
I did a quick Google search and found you probably got your script from here:
stackoverflow dot com slash questions slash 591853 slash search-for-a-string-in-all-tables-rows-and-columns-of-a-db
The comments in the answer also say it will be "RIDICULOUSLY slow" :)
The answer below that also suggests ApexSQL, or use a script with temporary tables instead of cursors, which will increase the speed significantly.