Search of table names

whytheq picture whytheq · Oct 26, 2012 · Viewed 294.5k times · Source

I use the following to search for strings in my stored procedures:

use DBname
SELECT Name
FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%xxx%'

Is it easy to amend the above so that it searches Table names in a specific db "DBname" ?

Answer

NeshaSerbia picture NeshaSerbia · Mar 3, 2014

I'm using this and works fine

SELECT * FROM INFORMATION_SCHEMA.TABLES 
WHERE TABLE_NAME LIKE '%%'