title: How to loop through all the tables in database and execute a select statement
body: <p>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</p>
  
  <pre><code>select * from custom.customerA where id = 'BBD87605-8992-40B5-9BEA-5C85F3969CEC'
  </code></pre>
  
  <p>But as i don't know the DB, i am trying something like below, but it's not correct.</p>
  
  <pre><code>select * from 'custom.'+INFORMATION_SCHEMA.Tables where id = 'BBD87605-8992-40B5-9BEA-5C85F3969CEC'
  </code></pre>
  
  <p>Basically i need to execute below query in all the tables in the DB.</p>
  
  <pre><code>select *, TableName from custom.{TABLE} where id = 'BBD87605-8992-40B5-9BEA-5C85F3969CEC'
  </code></pre>