日期:2014-05-16  浏览次数:20702 次

存储过程模式

create PROC [dbo].[GetExecSection]
AS
/*
PAGE: 分类信息维护页?? ?
Action: 添加分类信息
CreatedBy: detian.wang
CreatedDate: 20110408
ModifiedHistory:
Test Scripts:
*/
BEGIN
SET NOCOUNT ON
BEGIN TRY
BEGIN TRAN
--todo .......
select SectionID,Section from tbl_section? where SectionID in(select distinct SectionID from? tbl_ProBusiness);
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.LogError @CalledUSPName=@CalledUSPName,@ErrorUSPName=@ErrorUSPName,@ErrorDesc=@ErrorDesc
PRINT @ErrorDesc
END CATCH
SET NOCOUNT OFF
END