Thursday, 18 September 2014

Stored Procedure to delete user by userid with exception handling


SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE Procedure [dbo].[proc_DeleteUser]      
 ( 
 @UserId varchar(50), 
 @LastModifiedBy int 
 ) 
AS   
       
BEGIN   
   
 Begin Try    


   Update tbl_Users set IsDeleted='true',LastModifiedBy = @LastModifiedBy where UserId =@UserId  
       
 End Try   
   
 BEGIN CATCH   
   
     return  '0';   
   
 END CATCH   
   
END 


GO

No comments:

Post a Comment