Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test cases for SP - how to create?
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01326936
Message ID:
01326981
Views:
20
>>>>>I see, let me try. Also check your PM and I'm still wondering how can I quickly jump to the Help on the Error Message.
>>>>
>>>>I read it, but I have problems with connection to my SQL Server right now. Adobe is downloading its Update and get ALL my network power :-)
>>>
>>>No rush, I'm manually setting parameters in this SQL statement now. I hate manual typing... :)
>>
>>HA!
>>I think you will not have problems with that. You should use all 6 pairs of hands (Buddha) :-))))
>>I just sent you a PM, no need to write ALL parameters.
>
>http://www.setfocus.com/TechnicalArticles/sql-server-2005-tsql-2.aspx
>
>Yes, I need to write Kevin about it.
>
>I found that it should be
>
>-- If the error renders the transaction as uncommittable, we must rollback
>		IF XACT_STATE() <> 0
>            BEGIN
>            --print 'Rollback transaction'
>			ROLLBACK TRANSACTION
>            END
>
>       RAISERROR (@ErrorMessage , @ErrorSeverity, @ErrorState, @ErrorNumber)
>
>I already implemented the code in few procedures, now I would have to update them all :) Trust, but check! (Doverjaj, no proverjaj).

When I read BOL about XACT_STATE() (because I try to wrote all my queries for 2000 :o( it will return you if the transaction is commitable (1) or not (-1), so maybe, just maybe you need this:
IF XACT_STATE() < 0
   ROLLBACK TRANSACTION
ELSE IF XACT_STATE() > 0
     COMMIT TRANSACTION
But all depends what you want when you raise error.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform