SSIS and Sql Server Journey

Personal Notes of Sarabjit Singh and Bhavpreet Singh

Find the table to which a given column belongs – Sql Server

on January 31, 2012
SELECT * FROM sys.columns WHERE NAME LIKE '%ColumnName%'

Result Set will contain object_ids in which the “ColumnName” exists. Use following queries to get the corresponding object names.

SELECT * FROM sys.objects WHERE object_id in (39879409,

More civilized code goes here;)

 SELECT * FROM sys.objects O
  INNER JOIN sys.columns C
  ON O.object_id = C.object_id 
  WHERE C.NAME LIKE '%ColumnName%'


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: