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

Get Fabric certified for FREE! Don't miss your chance! 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
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Fabric Update Carousel

Fabric Monthly Update - February 2026

Check out the February 2026 Fabric update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.