?
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
Medium Priority
?
144 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 2000 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 2000 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

719 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