how to add a try 2fcatch to sql stored procedure

Solutions on MaxInterview for how to add a try 2fcatch to sql stored procedure by the best coders in the world

showing results for - "how to add a try 2fcatch to sql stored procedure"
Filippo
12 Jan 2020
1 CREATE PROCEDURE [dbo].[PL_GEN_PROVN_NO1]        
2       @GAD_COMP_CODE  VARCHAR(2) =NULL, 
3       @@voucher_no numeric =null output 
4       AS         
5   BEGIN  
6
7     begin try 
8         -- your proc code
9     end try
10
11     begin catch
12          -- what you want to do in catch
13     end catch    
14  END -- proc end
15