I have something along the lines of....
UPDATE....
IF @@ERROR <> 0
BEGIN
GOTO ERROR_HANDLER
END
ELSE
BEGIN
UPDATE ...
IF @@ERROR <> 0
BEGIN
GOTO ERROR_HANDLER
END
ELSE
BEGIN
GOTO SUCCESS_NOTIFICATION
END
END
ERROR_HANDLER: PRINT 'ERROR'
SUCCESS_NOTIFICATION: PRINT 'SUCCESS'
When it hits a GOTO SUCCESS_NOTIFICATION it prints out one message, ie SUCCESS. However when it hits a GOTO ERROR_HANDLER it prints out 2 messages, both ERROR and SUCCESS. It seems that when it hits the ERROR_HANDLER it continues to execute the SUCCESS_NOTIFICATION too. Can I have 2 labels in a TSQL statement?? or is this simply a layout issue? Thanks in advance.
UPDATE....
IF @@ERROR <> 0
BEGIN
GOTO ERROR_HANDLER
END
ELSE
BEGIN
UPDATE ...
IF @@ERROR <> 0
BEGIN
GOTO ERROR_HANDLER
END
ELSE
BEGIN
GOTO SUCCESS_NOTIFICATION
END
END
ERROR_HANDLER: PRINT 'ERROR'
SUCCESS_NOTIFICATION: PRINT 'SUCCESS'
When it hits a GOTO SUCCESS_NOTIFICATION it prints out one message, ie SUCCESS. However when it hits a GOTO ERROR_HANDLER it prints out 2 messages, both ERROR and SUCCESS. It seems that when it hits the ERROR_HANDLER it continues to execute the SUCCESS_NOTIFICATION too. Can I have 2 labels in a TSQL statement?? or is this simply a layout issue? Thanks in advance.