Posted By

hairajeshk on 09/15/10


Tagged

database find in column


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Tyster
Priestd09


Find Column Name in all tables in a Database


 / Published in: SQL
 

Find column name in all tables of a database

  1. SELECT t.name AS table_name,
  2. SCHEMA_NAME(schema_id) AS schema_name,
  3. c.name AS column_name
  4. FROM sys.TABLES AS t
  5. INNER JOIN sys.COLUMNS c ON t.OBJECT_ID = c.OBJECT_ID
  6. WHERE c.name LIKE '%EmployeeID%'
  7. ORDER BY schema_name, table_name;

Report this snippet  

You need to login to post a comment.