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
 Field common in several tables.

Author  Topic 

kid_on_the_block
Posting Yak Master

172 Posts

Posted - 2005-12-01 : 13:48:31
I have a database with 10 tables

I have a field named CustID .... I want to find out how many tables have this field CustID

Now one way was check up the design of every table & see whether its there or not (the field)

is there any query through which we can get this info Please help

Kristen
Test

22859 Posts

Posted - 2005-12-01 : 13:54:02
[code]
SELECT TABLE_SCHEMA + '.' + TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME = 'MyColumnName'
[/code]
Kristen
Go to Top of Page

kid_on_the_block
Posting Yak Master

172 Posts

Posted - 2005-12-01 : 14:35:02
Thanks , & what if the same is need in Sybase ...
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-12-01 : 23:47:24
Sorry, don't know. This is a Microsoft SQL Server forum, but others may be along who will know.

You could probably use the "syscolumns" table, in Sybase, instead.

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-02 : 00:14:37
Post sybase questions at Sybase Forums such as www.DBForums.com

Madhivanan

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

- Advertisement -