Hi guys,
I have stored procedure as below
I am trying to test my error handling and ran stored proc above and I got error as below :
I expected the error would say something "Adjustment mapping failed", any clue why it's not working?
Thanks guys.
I have stored procedure as below
Code:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER PROCEDURE [dbo].[proc_adj]
AS
SET NOCOUNT ON
DECLARE @proc_name sysname,
@error INT
-- initialise error/debug variables
SELECT @proc_name = OBJECT_NAME( @@PROCID ),
@error = 0
select test from test2
IF @@error <> 0 GOTO ADJ_MAP_ERROR
ADJ_MAP_ERROR:
RAISERROR ('%s: Adjustment mapping failed (SQLerror: %d)', 16, 1, @proc_name, @error)
RETURN (@error)
PRINT convert(varchar, getdate()) + ' FINISHED'
I am trying to test my error handling and ran stored proc above and I got error as below :
Code:
Msg 208, Level 16, State 1, Procedure proc_adj, Line 18
Invalid object name 'test2'.
Thanks guys.