Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transaction syntax
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00686750
Message ID:
00687047
Views:
42
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
Map
View

Click here to load this message in the networking platform