> I'm in the process of writing an update function within a VB6 application.
>
[quoted text clipped - 22 lines]
>
> Opinions?
His SP will have to return a success/fail flag.
>> I'm in the process of writing an update function within a VB6
>> application.
[quoted text clipped - 41 lines]
>
> Mike
Correct -- I guess I was thinking a little ahead. I may plan on having
additional queries/deletes within the SP that may need to be rolled back.
Yes, I can add the BeginTrans within the VB, my only other thought was that
other users may need to manually run the SP from outside the VB application.
In which case, I would want the BEGIN TRANS within the SP.
My dilemma, if you will, is that I need to call my VB function about 25
times to insert 25 rows separately. If there is an error, I want the
Registrants within my VB to rollback all the inserts from the beginning. If
I only add the BEGIN TRANS within the SP and it fails, it will only roll
back the one item.
>> I'm in the process of writing an update function within a VB6
>> application.
[quoted text clipped - 41 lines]
>
> Mike
SÁRINGER Zoltán - 30 Dec 2004 11:32 GMT
hi,
nested triggers and transactions are allowed on sql 2000.
see sql books online:
"When you are unsure if you are already in a transaction, SELECT @@TRANCOUNT
to determine if it is 1 or more. If @@TRANCOUNT is 0 you are not in a
transaction."

Signature
kecskemetisrac@free-mail.hu
remove "-" from email address when reply.
> Correct -- I guess I was thinking a little ahead. I may plan on having
> additional queries/deletes within the SP that may need to be rolled back.
[quoted text clipped - 53 lines]
> >
> > Mike
MikeD - 31 Dec 2004 06:16 GMT
> My dilemma, if you will, is that I need to call my VB function about 25
> times to insert 25 rows separately. If there is an error, I want the
> Registrants within my VB to rollback all the inserts from the beginning. If
> I only add the BEGIN TRANS within the SP and it fails, it will only roll
> back the one item.
Right. That's why a transaction should not be in the SP at all. It should
be in your VB code; started before the 1st Insert and committed upon
successful completion of all 25. As Wart said, you might want your SP to
return a success/fail value that you can check. If the SP returns failure,
have your VB code rollback everything (since everything up to that point it
part of a single transaction, there's only one rollback to do and it will
rollback everything from the point of the last BeginTrans method).
Mike