I have two sql db.
- Azure SQL (Cloud)
- MSSQL DB (Local)
I created a trigger at local db. My goal is send rows to cloud db when local db taking a data but when i try this code;
INSERT INTO CARI_HESAPLAR (cari_DBCno, cari_create_date, cari_unvan1)
VALUES (0, '2024-08-08 10:28:37.553', 'DENEME');
I am taking an error;
The operation could not be performed because OLE DB provider "MSOLEDBSQL" for linked server "SYMPLER" was unable to begin a distributed transaction.
It’s my local trigger;
`USE [MikroDB_V16_TEST]
GO
/****** Object: Trigger [dbo].[deneme] Script Date: 12.08.2024 09:35:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[deneme]
ON [dbo].[CARI_HESAPLAR]
AFTER INSERT
AS
BEGIN
exec denemeSp ‘DenemeDenemeDeneme’
END;
GO
`
It’s my procedure;
`USE [MikroDB_V16_TEST]
GO
/****** Object: StoredProcedure [dbo].[denemeSP] Script Date: 12.08.2024 09:19:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[denemeSP]
@column1 NVARCHAR(MAX)
AS
BEGIN
SET NOCOUNT ON;
SET XACT_ABORT ON;
BEGIN TRY
BEGIN TRAN;
INSERT INTO [SYMPLER].[isra].[dbo].[Form_deneme2] (rangedId, adsoyad)
VALUES ('0084', 'deneme');
COMMIT;
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0
BEGIN
ROLLBACK TRANSACTION;
END;
-- Hata mesajını döndürmek için
DECLARE @ErrorMessage NVARCHAR(4000), @ErrorSeverity INT, @ErrorState INT;
SELECT
@ErrorMessage = ERROR_MESSAGE(),
@ErrorSeverity = ERROR_SEVERITY(),
@ErrorState = ERROR_STATE();
RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState);
END CATCH
END;
GO
`
I researched this subject and found some solutions and tried configured my msdtc settings etc. How can i solve it? Its important for my company because company’s apps will entegrated other company apps if i found a way. Thank you in advance.