0

Is it possible to write a query that applies to an entire database as opposed to one table.

So instead of usin:

 select * from table_name where columnName = ?

Can I say select * db_tables from from db where the table contains the column A?

Is is possible? thanks

tadman
  • 208,517
  • 23
  • 234
  • 262
John
  • 3,965
  • 21
  • 77
  • 163

2 Answers2

3

You sure can!

SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME like '%A'
zambonee
  • 1,599
  • 11
  • 17
  • thanks for the help @zambonee...iv hit another wall if you could be on any help that would be great https://stackoverflow.com/questions/46107078/query-returning-wrong-value – John Sep 08 '17 at 00:54
0

You cannot do SELECT * FROM all the tables, but you can run a query aganist multiple tables using other statements in SQL.

Sai
  • 711
  • 6
  • 24