Friday, August 4, 2017

Find a specific column and/or table in SQL

I'll make this quick and just share the query:

SELECT       c.name  AS 'ColumnName',t.name AS 'TableName'
FROM          sys.columns c
JOIN             sys.tables  t   ON c.object_id = t.object_id
WHERE        c.name LIKE '%addNameHere%'
ORDER BY  TableName   ,ColumnName;


Enjoy!