Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello all,
I have written a SQL query which I want to extract on powerBI. The query includes UNION of multiple databases..
What I tried = " go to GET DATA - Server - AdvanceOptions and inserted my query and click OK."
It is asking me to give the database name. But query includes multiple databases.
How do I extract data from SQL through a query that unions multiple databases of SQL.
Solved! Go to Solution.
Hi @Anonymous ,
You could write the T-SQL which could get data from mutiple databases under SQL Statement.
You can run the query in your Sql Server databsed firstly, if that works successfully, then you could copy it under SQL Statement in power bi desktop.
In addition, you could refer to the query below and modify it based on your scenario.
select * from [server].[database].[schema].[table] union select * from [server].[database2].[schema].[table] union select * from [server].[database3].[schema].[table]
Hope this can help you.
Best Regards,
Cherry
Hi @Anonymous ,
Have you solved the problem?
If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
If you still need help, free to ask.
Best Regards,
Cherry
Hi @Anonymous ,
You could write the T-SQL which could get data from mutiple databases under SQL Statement.
You can run the query in your Sql Server databsed firstly, if that works successfully, then you could copy it under SQL Statement in power bi desktop.
In addition, you could refer to the query below and modify it based on your scenario.
select * from [server].[database].[schema].[table] union select * from [server].[database2].[schema].[table] union select * from [server].[database3].[schema].[table]
Hope this can help you.
Best Regards,
Cherry
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 200 | |
| 125 | |
| 102 | |
| 69 | |
| 53 |