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 2000 Forums
 SQL Server Development (2000)
 find table with ..

Author  Topic 

QuietRiot
Yak Posting Veteran

67 Posts

Posted - 2008-01-22 : 15:55:11

need to find all tables that contain both AccountNumber and DealerNumber

how can I do this?

jdaman
Constraint Violating Yak Guru

354 Posts

Posted - 2008-01-22 : 16:00:00
[code]SELECT a.TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS a
JOIN INFORMATION_SCHEMA.COLUMNS b ON a.TABLE_NAME = b.TABLE_NAME
WHERE a.COLUMN_NAME = 'AccountNumber'
AND b.COLUMN_NAME = 'DealerNumber'[/code]
Go to Top of Page

QuietRiot
Yak Posting Veteran

67 Posts

Posted - 2008-01-22 : 16:02:11
perfect!!
Go to Top of Page
   

- Advertisement -