Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
dading
Helper II
Helper II

Query data from 2 databases

Hi...

Just want to know, might be someone has an experience to get the data from 2 databases. Is it possible to do that using One native query?

4 REPLIES 4
camargos88
Community Champion
Community Champion

Hi @dading ,

 

Check these links:

https://docs.microsoft.com/pt-br/power-query/power-query-folding

https://blog.pragmaticworks.com/power-bi-checking-query-folding-with-view-native-query

 

Are those databases in the same server ? If you are append them, you can union them using SQL. Doens't it work ?

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Yup..those databases are in one server. If i query each table then i do append,yes it works. But i mean, i want to join or union those databases directly using one query,is it possible?

Hi @dading ,

 

Based on my research, if we want to use native sql statement to union table from different database such as select * from databaseA.dbo.table1 union select * from databaseB.dbo.table2, but when using Sql.Database function , it must special a database, when using Sql.Databases function, it does not support write native sql query. So we think if you want to get them in one function, you can use Sql.Databases to get all the tables and filter the one you needed, but unfortunately it is still cannot transfer into native query. May be you can consider create a view in sql side?


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@dading ,

 

I've tried it with 2 databases, I know it's possible with 2 tables.

However you can check it after merge the tables by clicking with right button and check if the native query option is enable.

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors