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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Finding a table name which have a specific field?

Author  Topic 

zeeshan13
Constraint Violating Yak Guru

347 Posts

Posted - 2007-04-10 : 15:13:43
Hi All,

Is there a way to find a table name, if I know the field name. Thats the only information I have.

Lets say I want to know that in the entire database which table holds the column/field 'EmployeeID' (thats the only information I have).

That is, list the name of table/s which holds the 'EmployeeID' field.

Is there a way to find out this, in SQL?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-10 : 15:19:29
select * from information_schema.columns


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Zim327
Yak Posting Veteran

62 Posts

Posted - 2007-04-10 : 15:20:56
Look in this thread
[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81255[/url]

Best regards,
Zim
(Future Eternal Yak God Emperor)
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-10 : 15:25:10
He only wanted the table name by searching for column name.
But you are right, that script also searches the tables...


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

zeeshan13
Constraint Violating Yak Guru

347 Posts

Posted - 2007-04-10 : 16:04:56
Peso,

Thanks a lot :)
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-11 : 08:44:37
quote:
Originally posted by Zim327

Look in this thread
[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81255[/url]

Best regards,
Zim
(Future Eternal Yak God Emperor)

No thats not correct answer

Madhivanan

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

- Advertisement -