1

Is it possible for me to insert some data from one database to another in Azure sql?

Let's say I have a trigger in db1 that updates some values in db2.

I read about elastic queries but it seems like they are read-only so they don't solve my problem.

Bani
  • 542
  • 4
  • 20
  • I think one phrase you may want to search is "linked server". https://www.mssqltips.com/sqlservertip/6224/create-a-sql-server-linked-server-to-azure-sql-database/ https://learn.microsoft.com/en-us/sql/relational-databases/linked-servers/linked-servers-database-engine?view=sql-server-ver16 Even if you can do it... tread lightly. Or you'll create a spaghetti mess of code. – granadaCoder May 31 '22 at 13:00
  • Azure SQL Databases are, by design, contained databases; you cannot have cross database queries. If you need cross database queries, there are many hoops you have to jump through and the performance is poor. If you need an environment with multiple databases, then you should be using a SQL Server Instance in Azure, not an Azure SQL Database. – Thom A May 31 '22 at 13:14

2 Answers2

2

You can't use cross-database in Azure Sql Server because databases can't see eachother physically , you could use elastic pools but they are Read Only. A solution is to use SQL Managed Instance to upload your instance . This supports cross-database queries but it was expensive.

Ledio
  • 116
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 02 '22 at 18:00
0

There was some previous discussion here about doing similar:

C# Azure Function trigger when SQL Database has a new row added without polling

There is also the Azure SQL Bindings for Azure Functions but they are input bindings and not triggers and they're still in preview and limited to C#, JavaScript and Python.

Azure SQL bindings for Azure Functions overview (preview)

There was a new announcement last week after MS Build however for Azure SQL Database External REST Endpoints Integration (hopefully they don't refer to it as ASDEREI) but this is currently in preview under Early Adoption Program (EAP).

Announcing the “Azure SQL Database External REST Endpoints Integration” Early Adoption Program

BrettMiller
  • 946
  • 2
  • 5
  • 12