Link to home
Start Free TrialLog in
Avatar of vpnsol123
vpnsol123

asked on

SQL Query against multiple databases

I need to write a query, that will be used as a view to select all columns from the same named table in each of my databases into a single result panel.
Avatar of JesterToo
JesterToo
Flag of United States of America image

If this is Sql Server then you can use multi-part names that are capable of referencing objects from different schemas, different databases and even different servers.

See this link for more info...   https://docs.microsoft.com/en-us/sql/t-sql/language-elements/transact-sql-syntax-conventions-transact-sql
Avatar of vpnsol123
vpnsol123

ASKER

Thank you for the above.  What I am looking to do is to write a single query the will read the database names out of the sys_databases table and run the query against each of them.  Sorry, that was not clear at all in my initial post.
ASKER CERTIFIED SOLUTION
Avatar of JesterToo
JesterToo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Sharath S
Sharath S
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks