Showing posts with label t-sql table name column search. Show all posts
Showing posts with label t-sql table name column search. Show all posts

Wednesday, February 29, 2012

Table / Column Search

SELECT

c.TABLE_NAME

, c.COLUMN_NAME

FROM INFORMATION_SCHEMA.TABLES t

JOIN INFORMATION_SCHEMA.COLUMNS c

ON t.TABLE_CATALOG = c.TABLE_CATALOG

AND t.TABLE_SCHEMA = c.TABLE_SCHEMA

AND t.TABLE_NAME = c.TABLE_NAME

AND t.TABLE_TYPE = 'BASE TABLE'

WHERE c.COLUMN_NAME LIKE '%user%'