General information
Forum:
Microsoft SQL Server
Thanks for the suggestion, this is exactly what I was looking for. My only concern is with the raiseerror function. See this sp is used by a VFP program and a ASP website. Foxpro handles the raiseerror() fine, but as you probably know, ASP dosen't. It just displays the internal server error page. I do have a custom 500 error page that traps the error and sends me an email with the error info, but I dont want to get an email for those kind of errors that I check for .... ohh well. I might be able to live with it. What would you do in this situation?
Eric
>>Im just wondering if there is an eaiser way to accomplish this?
>
>not really. SQL Server's error handling is very primitive.
>I'm hopeing that things will change with Yukon.
>
>The only suggestion that I have is to not do the second insert if the first fails. I see no reason to cause SQL Server to do work that will just be reversed. you could try something like this:
>
>DECLARE @result int
>INSERT INTO students ...
>SET @result = @@ERROR
>
>IF @result != 0 GOTO __cleanup
>
>IF @logmove = 1
>BEGIN
> INSERT INTO movelog ...
> SET @result = @@ERROR
>END
>
>__cleanup:
>IF @result != 0
>BEGIN
> ROLLBACK TRANSACTION
> RAISERROR('Unable to move student out.', 16, 1)
>END
>ELSE COMMIT TRANSACTION
>
>RETURN @result
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only