Hello,I have a procedure , that may be raiserror on many situation but thaterror never shown on client application ? client use C++ and OLEDB forconnection to sql server.CREATE PROC pr_WaitToTemp @IdNo varchar(50)ASBEGIN DECLARE @InDate datetime DECLARE @Repeat bit DECLARE @GID bigint DECLARE @Title int DECLARE @Time datetime DECLARE @Error int SET @Time = DATEADD(day, DATEDIFF(day, 0, getdate()), 0) SELECT TOP 1 @GID = GID, @Title = Title, @InDate = InDate, @Repeat = Repeat FROM tbl_wait WHERE IdNo = @IdNo IF (@InDate IS NULL OR @Repeat IS NULL) BEGIN RAISERROR('ID code not exist.', 16, 1) RETURN -1 END BEGIN TRANSACTION MOVE_TO_TEMP_1 INSERT INTO tmp4out (IdNo, InDate, OutDateOrd, Repeat) VALUES (@IdNo, @InDate, @Time, @Repeat) SELECT @Error = @@ERROR IF @Error <> 0 BEGIN ROLLBACK TRANSACTION MOVE_TO_TEMP_1 RETURN -2 END DELETE FROM tbl_wait WHERE IdNo = @IdNo SELECT @Error = @@ERROR IF @Error <> 0 BEGIN ROLLBACK TRANSACTION MOVE_TO_TEMP_1 RETURN -3 END COMMIT TRANSACTION MOVE_TO_TEMP_1 BEGIN TRANSACTION MOVE_TO_TEMP_2 INSERT INTO tbl_waitarchive (GID, Title, IdNo, InDate, OutDateOrd, Stay) VALUES (@GID, @Title, @IdNo, @InDate, @Time, DATEDIFF(day, @InDate, @Time)) SELECT @Error = @@ERROR IF @Error <> 0 BEGIN RAISERROR('Can not insert in archive.', 16, 1) ROLLBACK TRANSACTION MOVE_TO_TEMP_2 RETURN -4 END COMMIT TRANSACTION MOVE_TO_TEMP_2 RETURN @ErrorEND
Kind Regards,sasan.