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.
| Author |
Topic |
|
mathiyazhagan.sekar@gmail
Starting Member
11 Posts |
Posted - 2008-05-19 : 05:24:23
|
| Hi All, How to find all the tables of a database containing a column . for example,how list all the tables of employee database having employeeid ?Cheers,MathiIndia. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-05-19 : 05:25:44
|
select table_name from information_schema.columns where column_name = 'employeeid' E 12°55'05.25"N 56°04'39.16" |
 |
|
|
ranganath
Posting Yak Master
209 Posts |
Posted - 2008-05-19 : 05:27:17
|
| Hi,Try with thisSelect distinct Object_name(id) From sys.syscolumns where name = 'EmployeeId' |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-05-19 : 05:57:43
|
quote: Originally posted by ranganath Hi,Try with thisSelect distinct Object_name(id) From sys.syscolumns where name = 'EmployeeId'
orSelect distinct object_name(object_id) From sys.columns where name = 'EmployeeId'MadhivananFailing to plan is Planning to fail |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2008-05-19 : 06:23:47
|
| http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=65666--Lumbago |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-19 : 06:41:38
|
| sp_msforeachtable 'IF COL_LENGTH(''?'',''YourColumnName'') >0 SELECT ''?''' |
 |
|
|
saruva
Starting Member
1 Post |
Posted - 2008-06-02 : 21:56:52
|
| select o.name as table_name, s.name as column_name from dbo.syscolumns s, dbo.sysobjects owhere s.name like '%employee_id%'and s.id = o.idsundar saruva |
 |
|
|
|
|
|