SQL Server Query execution is running indefinitely but not giving results

jslywgbw  于 2023-08-02  发布在  其他
关注(0)|答案(1)|浏览(177)

I'm trying to learn error handling and i made this stored procedure for updation of data and the Stored Procedure is created successfully but execution takes very long time.

ALTER procedure [dbo].[uspUpdateData]
@CUST_CITY varchar(50)
as 
begin
begin try
begin transaction
update [dbo].[employee]
set CUST_CITY=@CUST_CITY 
COMMIT TRANSACTION
end try
begin catch
rollback transaction
END CATCH
END
GO

I have looked everywhere but this issue still persist edit:runs indefinitely means its execution loading.

e5nqia27

e5nqia271#

Rewrited with indentation and ending code with ";" :

ALTER procedure [dbo].[uspUpdateData] 
   @CUST_CITY varchar(50) 
as 
begin 
   begin try 
      begin transaction; 
      update [dbo].[employee] 
      set CUST_CITY=@CUST_CITY; 
      COMMIT TRANSACTION; 
   end try 
   begin catch 
      rollback transaction; 
   end catch
END 
GO

There is no reason that this query runs indefinitely...

相关问题