Currently I have a large import process that I'm trying to wrap inside a transaction so if anything breaks - i could rollback. The issue I have is that when the TSQL inside the trans blows up, it won't rollback when the following SQL error occurs
Msg 8152, Level 16, State 14, Line 249
String or binary data would be truncated.
The statement has been terminated.
The below wraps this import TSQL
DECLARE @error INT
SELECT @error = 0
BEGIN TRANSACTION
--** begin import TSQL
--** end import TSQL
SELECT @error = @@error
IF @error != 0 GOTO handle_error
COMMIT
handle_error:
IF @error != 0
BEGIN
ROLLBACK
END