MSSQL 标准PROC 写法

MSSQL 标准PROC 写法

ALTER PROC [dbo].[usp_ADM_InsertFlowSortInfo]
@FlowSortName NVARCHAR(50),
AS
/*
PAGE: 分类信息维护页    
Action: 添加分类信息

CreatedBy: wangpeng
CreatedDate: 20100906
ModifiedHistory:

Test Scripts:


*/ 
BEGIN
 SET NOCOUNT ON
  BEGIN TRY
   BEGIN TRAN
   --todo:业务逻辑
   
   COMMIT TRAN
  END TRY
  BEGIN CATCH
   ROLLBACK TRAN
   DECLARE @ErrorDesc nvarchar(1000)
   DECLARE @CalledUSPName nvarchar(50)
   DECLARE @ErrorUSPName nvarchar(50)

   SET @ErrorDesc='Error Stored Procedure: ' + ISNULL(ERROR_PROCEDURE(),OBJECT_NAME(@@PROCID)) + ', Line Number: ' + CONVERT(nvarchar(20),ERROR_LINE()) + ', Message: ' + ERROR_MESSAGE()
   SET @CalledUSPName=OBJECT_NAME(@@PROCID)
   SET @ErrorUSPName=ISNULL(ERROR_PROCEDURE(),OBJECT_NAME(@@PROCID))
   EXEC dbo.usp_LogError @CalledUSPName=@CalledUSPName,@ErrorUSPName=@ErrorUSPName,@ErrorDesc=@ErrorDesc
   PRINT @ErrorDesc
  END CATCH
 SET NOCOUNT OFF
END

你可能感兴趣的:(MSSQL)