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 |
DarrenHambleton
Starting Member
1 Post |
Posted - 2008-11-21 : 12:03:20
|
Hi Guys,I would like to generate a list of all tables within a database which has a Column "CUSTNMBR"CheersDarren |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-21 : 12:12:07
|
[code]SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME='CUSTNMBR'[/code] |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-21 : 12:13:27
|
if you want to exclude views modify it asSELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS cINNER JOIN INFORMATION_SCHEMA.TABLES tON t.TABLE_NAME=c.TABLE_NAMEWHERE c.COLUMN_NAME='CUSTNMBR'AND t.TABLE_TYPE='BASE TABLE' |
|
|
|
|
|