Reference to external databases in Azure how to do it?

Ianez Mathias 60 Reputation points
2024-01-12T12:22:09.2366667+00:00

Hi guys, I have the following scenario. I have my local database as follows. Database

  • Base A
  • Base B
  • Base C

I have a view in Base A that obtains information from Base B and C.

SELECT
    A.Field1,
    B.Field2,
    C.Field3
FROM
    A.dbo.TableA AS A
INNER JOIN
    B.dbo.TableB AS B ON A.CampoChave = B.CampoChave
INNER JOIN
    C.dbo.TableC AS C ON A.CampoChave = C.CampoChave

When migrating Base A to Azure, it gives an error as it is not possible in Azure to have external references to its own base. This is a problem for me, is there any alternative?

Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,470 questions
0 comments No comments
{count} votes

Accepted answer
  1. Erland Sommarskog 116.8K Reputation points MVP
    2024-01-12T22:32:52.8633333+00:00

    Olaf is incorrect. There are alternatives. You can use an elastic query. Yes, this is a preview feature, and it is one of these eternal previews - this feature has been there for years. I have never played with it myself, but you may want to try it. You should beware of that Azure SQL Database is not the same place as on-prem SQL Server, and moving to Azure SQL Database from on-prem is a bit of a culture clash. Azure SQL Managed Instance may make you feel more at home. But the price tag may be stiffer.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Olaf Helper 46,041 Reputation points
    2024-01-12T12:24:48.6333333+00:00

    This is a problem for me, is there any alternative?

    Azure SQL database don't support cross database references and there is no way around. Use an other SQL product, like SQL Managed Instance or a Azure VM with SQL Server.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.