Pages

Tuesday, March 3, 2015

sql query to find matching columns in all tables

ms sql, matching columns in table, 

SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%tag%'



tag: table name


this query will help you to find all matching columns in tables