Not sure if this is possible. I have a SQL Server database with the same column name in multiple tables. Is there a way to write a query to return the rows from all the tables with a certain value in a specified column. For example the following is for one table:
select * from table1 where state = 'NY'
Can I write something that will search through all the tables in the database that have a column named state that has a value of 'NY'? Without knowing the specific table name?