Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi All,
I've two views in two different Azure SQL database:
both DB1 , DB2 is in the same server. I need to join these two views. When i ran the select query it is throwing the below error:
Msg 40515, Level 15, State 1, Line 30
Reference to database and/or server name in 'DB2.dbo.view2' is not supported in this version of SQL Server.
This is my select query:
select top 10 * from [DB1].[dbo].[view1] t
left join [DB2].[dbo].[view2] cr on t.InternalGTECode = cr.New_Engagement_Mirror_Code
i tried to run this query in both db as well as the master db.. but getting the reference error. Please help
Thank you for reaching out to the Microsoft Fabric Forum Community.
As per my knowledge, You are using Azure SQL Database, and in this service cross-database queries are not supported. Even if DB1 and DB2 are on the same logical server, Azure SQL Database isolates each database, so you cannot use three-part naming like DB2.dbo.view2. That is why you are getting Msg 40515. To fix this, you must either use Elastic Query (create an external table to access DB2 from DB1), move both views into the same database, or use Azure SQL Managed Instance, which supports cross-database joins.
If you still have issue or doubts please do reach out to Azure SQL forum, they will help you on this.
Azure SQL | Microsoft Community Hub
Thanks.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.