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 |
Petronas
Posting Yak Master
134 Posts |
Posted - 2014-12-16 : 11:23:05
|
Hello ,We have about 60 several tables with order id as a column in all of them . Every day I have to check if certain order id’s exist in the 60 tables. I just need to get the name of the table if it exists. Is there a way to dynamically keep changing the name of the table instead of having all 45 tables in the script? Thanks for your help, Petronas |
|
sz1
Aged Yak Warrior
555 Posts |
Posted - 2014-12-16 : 11:27:12
|
You can try something like this, change the string to what you want to find and it will return the table name(s) where its found.SELECT COLUMN_NAME, TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE '%Order_RecID%'We are the creators of our own reality! |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|