I need to search that which table in my database has a record which has the given primary key. If i would have known the database, query would have been quite simple, like below
select * from custom.customerA where id = 'BBD87605-8992-40B5-9BEA-5C85F3969CEC'
But as i don't know the DB, i am trying something like below, but it's not correct.
select * from 'custom.'+INFORMATION_SCHEMA.Tables where id = 'BBD87605-8992-40B5-9BEA-5C85F3969CEC'
Basically i need to execute below query in all the tables in the DB.
select *, TableName from custom.{TABLE} where id = 'BBD87605-8992-40B5-9BEA-5C85F3969CEC'