Explore Courses Blog Tutorials Interview Questions
0 votes
in Azure by (12.7k points)
edited by

I have a SQL Azure Database Server and I need to query between the Databases but can't figure out how to accomplish this.

Here is the structure of my databases:


  • Database.A
  • Database.B
  • Database.C

In Database.A I have a Stored Procedure that needs to retrieve data from Database.B. Normally, I would reference the database like SELECT * FROM [Database.B].[dbo].[MyTable] but this does not appear to be allowed in SQL Azure.

Msg 40515, Level 15, State 1, Line 16

Reference to the database and/or server name in 'Database.B.dbo.MyTable' is not supported in this version of SQL Server.

Is there a way to do this on the database end?

In the final version Databases, A & C will both need data from Database B.

1 Answer

0 votes
by (9.6k points)

Azure now provides support for cross database queries.

You can refer to this documentation: click here

Browse Categories