Solved

Msg 3609, Level 16, State 1, Line 1 The transaction ended in the trigger. The batch has been aborted.

Posted on 2016-08-26
6
101 Views
Last Modified: 2016-10-14
this is my trigger
SET IMPLICIT_TRANSACTIONS OFF 
GO 
ALTER TRIGGER [dbo].[myInsertTrigger]
ON [migratedData].[dbo].[t1] 
FOR INSERT
AS 

		--DECLARE @F1 VARCHAR(50)
		--DECLARE @F2 VARCHAR(50)
		--SELECT @F1 = (SELECT [f1] FROM Inserted)
		--SELECT @F2 = (SELECT [f2] FROM Inserted)
		--PRINT @F1
		--PRINT @F2

SET XACT_ABORT ON 
 COMMIT
	BEGIN  TRY
			INSERT INTO OPENQUERY (MYSQL, 'SELECT * FROM t2')
			--VALUES(@F1,@F2)
			VALUES('DDDDDD','DDD@F2')
	
	END TRY
	BEGIN CATCH
		PRINT 'FFLF'
	END CATCH
	
	

Open in new window


what is my error


please help me

Thanks
0
Comment
Question by:yoosuf pp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 41771525
too much comments
remove the comment clutter

it's useless
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 500 total points (awarded by participants)
ID: 41771526
the error is the COMMIT (in the trigger). remove that one, and it's ok
see more on this support note:
https://technet.microsoft.com/en-us/library/ms187844(v=sql.105).aspx
using @@trancount etc ...
0
 

Author Comment

by:yoosuf pp
ID: 41771610
sir
without commit

i get this error

OLE DB provider "MSDASQL" for linked server "MYSQL" returned message "[MySQL][ODBC 5.1 Driver]Optional feature not supported".

(0 row(s) affected)
Msg 3616, Level 16, State 1, Line 1
An error was raised during trigger execution. The batch has been aborted and the user transaction, if any, has been rolled back.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points (awarded by participants)
ID: 41773219
I had seen that also on my side, and there is no direct solution within a trigger.
You will need an async solution
Trigger inserts into a local table, and a job to do the insert into the mysql table from there.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question