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

I have an SQL Azure Database & I need to query between the Databases but I am not able to figure out, how to do it?

Here is the database's structure:

  • Server.X
    • 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 database and/or server name in 'Database.B.dbo.MyTable' is not supported in this version of SQL Server.

I need a way to do this.

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

1 Answer

0 votes
by (16.8k points)
Whenever you want to import the data, you must create a new table within the same structure that want to attain, then export the data from the other database, then add this to the new table.

Later on, you can easily use your logic in order to import the data.

Browse Categories