How to add a Try/Catch to SQL Stored Procedure
See TRY…CATCH (Transact-SQL) CREATE PROCEDURE [dbo].[PL_GEN_PROVN_NO1] @GAD_COMP_CODE VARCHAR(2) =NULL, @@voucher_no numeric =null output AS BEGIN begin try — your proc code end try begin catch — what you want to do in catch end catch END — proc end