Sie sind auf Seite 1von 2

CREATE Procedure usp_AreaMasterAdd

(
@P_AreaId int,
@P_AreaName varchar(50),
@P_RegionID int,
@P_status nchar(10),
@P_InsertedDatetime smalldatetime,
@P_InsertedBy int,
@P_InsertedMachineInfo varchar(50),
@P_UpdatedDatetime smalldatetime,
@P_UpdatedBy int,
@P_UpdatedMachineInfo varchar(50)
)
AS
BEGIN
declare @V_ERROR_NUM INT
declare @Result int
BEGIN TRY
SET @Result=1
INSERT INTO AreaMaster
(
AreaId,
AreaName,
RegionID,
status,
InsertedDatetime,
InsertedBy,
InsertedMachineInfo,
UpdatedDatetime,
UpdatedBy,
UpdatedMachineInfo
)
VALUES
(
@P_AreaId,
@P_AreaName,
@p_RegionID,
@p_status,
@p_InsertedDatetime,
@p_InsertedBy,
@p_InsertedMachineInfo,
@p_UpdatedDatetime,
@p_UpdatedBy,
@p_UpdatedMachineInfo
)
SET @V_ERROR_NUM=@@ERROR
IF @V_ERROR_NUM !=0
GOTO Err_Handler
-----ERR HANDLER
Err_Handler:
if @V_ERROR_NUM>0
Begin
set @Result=0
--exec LogErrors
end
END TRY
----START CATCH
BEGIN CATCH
set @V_ERROR_NUM=@@ERROR
if @V_ERROR_NUM>0
Begin
set @Result=0
--exec LogErrors
end
end catch
Select @Result
END
GO
/*
GRANT EXEC ON Stored_Procedure_Name TO PUBLIC
GO
*/

Das könnte Ihnen auch gefallen