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

60 Days of Data Days! Live and on-demand sessions, challenges, study groups and more! And it's all FREE!. Join now. Learn more

Reply
WinterGarden
Resolver I
Resolver I

Azure SQL db issue: Reference to database and/or server name is not supported in this version of SQL

Hi All,

I've two views in two different Azure SQL database:

  1. [dbo].[view1] in DB1
  2. [dbo].[view2] in DB2

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

1 REPLY 1
v-priyankata
Community Support
Community Support

Hi @WinterGarden 

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.

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Top Solution Authors