Today, I checked the project sample code. I also wrote the try-catch code block in the stored procedure. I thought it was fresh. I don't know if it was the new syntax of SQL 2005 (I used to use 2000). The Code is as follows:
Create proc [dbo]. [p_TNoticeAdmin_RowByLastModifyDate]
@ IntNoticeAdminID INT
AS
Set nocount on;
-- ���� Declare
DECLARE @ btResult BIT; -- fig (0: FIG, 1: FIG)
-- Main code: Begin
BEGIN TRY
SELECT ModifyDate FROM TNoticeAdmin
WHERE NoticeAdminID = @ intNoticeAdminID
SET @ btResult = 0;
END TRY
BEGIN CATCH
DECLARE @ strErrContent VARCHAR (50 ),
@ IntErrorNumber INT,
@ IntErrorSeverity INT,
@ IntErrorState INT,
@ StrErrorProcedure NVARCHAR (126 ),
@ IntErrorLine INT,
@ StrErrorMessage NVARCHAR (4000 );
SET @ strErrContent = '������������������������������ ���� ';
SET @ intErrorNumber = ERROR_NUMBER ();
SET @ intErrorSeverity = ERROR_SEVERITY ();
SET @ intErrorState = ERROR_STATE ();
SET @ strErrorProcedure = ERROR_PROCEDURE ();
SET @ intErrorLine = ERROR_LINE ();
SET @ strErrorMessage = ERROR_MESSAGE ();
EXEC p_TDBErrLog_Create @ strErrContent, @ intErrorNumber, @ intErrorSeverity, @ intErrorState,
@ StrErrorProcedure, @ intErrorLine, @ strErrorMessage;
RAISERROR (@ strErrorMessage, @ intErrorSeverity, @ intErrorState, @ strErrorProcedure, @ intErrorLine );
SET @ btResult = 1;
END CATCH
Haha, although SQL 2008 is coming out, it is also a big gain.