Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Search a Column in database

Author  Topic 

diyagan
Starting Member

22 Posts

Posted - 2007-11-04 : 22:45:31
Hi,

Can any one say how to search a particular column in a database so that the tables containing the column are listed

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-11-04 : 22:54:49
you can look into syscolumns and get the tables with that column name...

SELECT Object_name(ID) As TableName,*
FROM Syscolumns
WHERE Name = 'somecolumn'


Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

diyagan
Starting Member

22 Posts

Posted - 2007-11-04 : 23:03:06
Its working fine ..
thank you
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-11-05 : 01:12:56
or

Select table_name from information_schema.columns
where column_name='your column'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -