How to find a column in database tables [Resolved]

Posted by Sriharim under Sql Server on 7/10/2015 | Points: 10 | Views : 1183 | Status : [Member] | Replies : 1
Example: In employee database, multiple tables and schema are there. I need to know in how many tables the column Emp_id is there.

How to find ??

Mark as Answer if its helpful to you
---
Srihari



Responses

Posted by: Bandi on: 7/10/2015 [Member] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
use Employee
GO
SELECT OBJECT_NAME(c.object_id) TableName, c.name
,SCHEMA_NAME( schema_id)
FROM sys.columns c
JOIN Sys.objects o on c.object_id = o.object_id
WHERE c.name = 'Emp_ID'
and o.type = 'U'


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Sriharim, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response