user8796222
user8796222

Reputation: 3

Trigger from local sql database to azure sql db

I have a local and an Azure database. When a row is inserted in the local db, I would like it to insert it in the Azure one. I have created a trigger on the local db for that task:

USE [db_local] 
Create trigger [dbo].[trigInverse] on [dbo].[db_local]
after insert
 as 
begin
  insert into [serverazure.DATABASE.WINDOWS.NET].[db_azure].[Access].[Companies]([CompanyName])
  select NAME
from inserted;
end 

However, when I try to insert a row the error in picture1 appears

enter image description here

I cannot see what the parameter is, and how to set a correct value in that error message.

I did some tests to find the cause: I put that trigger between 2 local db, and tried adding rows to the source db, and it works In the linked server node, these are the settings

enter image description here

Upvotes: 0

Views: 163

Answers (1)

Wilson Vargas
Wilson Vargas

Reputation: 2899

You can use Azure SQL Data Sync, download and install in your local server SQL Azure Data Sync Agent

Then setup your azure data base like this:

Getting Started with Azure SQL Data Sync

It will sync your databases every 5 minutes.

Upvotes: 2

Related Questions