Can not be ignored in the trigger error?

My situation is this: when insert data into the A table, need to notice a user to send information, because the data is inserted into the third party software to do, I can't control, so I in the A table plus a trigger to realize, the question now is to send information error here is negligible, that is to say if the sending failure does not affect the data insertion, excuse me in triggers to ignore the error, let the transaction to continue.

Started by Daphne at November 14, 2016 - 9:42 AM

In the try catch with the trigger, and then eventually want to continue operating in final inside, but from the maintenance of data consistency, not ignore, because your data against your own or sqlserver rules

Posted by Jocelyn at November 23, 2016 - 10:15 AM

In online help not find a final information, can you post the code to have a look? If final?

Posted by Daphne at December 07, 2016 - 11:11 AM

Feel shy, misleading, finally is the concept of C#, confused. You can still use try catch, just catch to error, not rolled back, you want to execute statements into catch. But no assurance of success.

Posted by Jocelyn at December 14, 2016 - 11:46 AM

No, catch to error, transaction must roll back, then the operation of the database will not be saved.

Posted by Daphne at December 21, 2016 - 12:10 PM

Consider adding a state listed in the table to operate
Insert data and send the message as the two logic
Insert the data when the default to a state
Then from time to time to send a message sent after the state is set to another value

Posted by Jerry at January 03, 2017 - 12:36 PM

In the trigger.:

To send information operation
if @@error <> 0
print 'error'

Just check error, can continue to run

Posted by Ignativs at January 03, 2017 - 3:21 PM

In addition, suggest you send the message code, into a storage process, the storage process and then call in the trigger:

begin try
The stored procedure exec to send information.
end try
begin catch
select 'Failed to execute'
Here will not roll
end catch

Posted by Ignativs at January 12, 2017 - 2:24 PM

Try again this:


-- save a transaction
SAVEPOINT xxx 

begin try  
   Or calling a stored procedure, or simply write code
   The stored procedure exec to send information.      
end try  
begin catch  
  select 'Failed to execute'  
  - once the error, just roll back to the transaction on, continue
  ROLLBACK [WORK] TO SAVEPOINT xxx
end catch  

Other code

Posted by Ignativs at January 14, 2017 - 1:25 PM