This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. 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.
Check out the April 2026 Fabric update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.