Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have try this procedure code but some where i get error as ;
i hav put end of statement in colon and proceed but also get error

my procedure code is
create procedure demo 
@input int as 
declare @transcounter int
set @transcounter=@@TRANCOUNT
IF @@TRANCOUNT>0
save tran demo
else
begin try
delete emp where empid='1'
commit tran;


what i did wrong in this query

thanks
Posted

1 solution

HI
Try this

SQL
create procedure demo1
@input int as 
declare @transcounter int
set @transcounter=@@TRANCOUNT
IF @@TRANCOUNT>0
save tran demo
else
begin try
delete emp where empid='1'
commit tran

END TRY
BEGIN CATCH
END CATCH; 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900