How to find field exists in which table +sql server

Hi,
I know the field exists in databse but,need to know in which table.
Any suggestions are appreciated.

Cheers
RIASAsked:
Who is Participating?
 
jimyXConnect With a Mentor Commented:
Use IF EXISTS as follows:
if exists (select TheColumnName from INFORMATION_SCHEMA.Columns where Table_Name = 'YourTable')
0
 
mayank_joshiConnect With a Mentor Commented:
this will dispaly the table name in which the column exists:-

select OBJECT_NAME(object_id) from sys.columns where name='your_column_name'

Open in new window

0
 
RIASAuthor Commented:
Cheers mates!!!
0
 
mayank_joshiCommented:
alternative way :-

select TABLE_NAME from INFORMATION_SCHEMA.COLUMNS where COLUMN_NAME='your_column_name'

Open in new window

0
All Courses

From novice to tech pro — start learning today.