首先,我需要检查spOBJ_CopyInspectiontask
是否有任何错误,如果没有错误,则只进入插入语句。
DECLARE @tblSystemId TABLE
(
OldSysId int, NewSysId int,
OldTaskId int, NewTaskId int,
TaskObjectIds varchar(max) null
);
INSERT INTO @tblSystemId (OldSysId , NewSysId, OldTaskId, NewTaskId, TaskObjectIds)
EXEC dbo.spOBJ_CopyInspectiontask @UserId, @TargetCustomerId, @TargetContractId, @TargetSiteId, @SourceCustomerId, @OldTaskId, @SystemName, @Checkall, @CopyReports, @Return OUTPUT, @ObjectIds OUTPUT;
我该怎么检查?
答案 0 :(得分:2)
也许你想要一个try / catch块:
BEGIN TRY
INSERT INTO @tblSystemId (OldSysId , NewSysId, OldTaskId, NewTaskId,TaskObjectIds )
EXEC dbo.spOBJ_CopyInspectiontask @UserId,@TargetCustomerId, @TargetContractId, @TargetSiteId,
@SourceCustomerId, @OldTaskId, @SystemName, @Checkall, @CopyReports, @Return OUTPUT, @ObjectIds OUTPUT;
END TRY
BEGIN CATCH
-- do something here in the event of failure
END CATCH;