btw - word of warning - the @@error variable contains the error code from
the LAST SQL statement to be executed only. So if you had:

DELETE From blah blah ...
SELECT @@rowcount
IF @@error <> 0
   BEGIN
        GOTOT ERROR_EXIT
   END

@@error would be 0 even if the delete statement worked ok as you are testing
the result of the SELECT @@rowcount statement which will be 0!



-----Original Message-----
From: Andy Ewings 
Sent: 20 June 2003 13:09
To: '[EMAIL PROTECTED]'
Subject: RE: Confirm a successful execution of a query?


Hi

in your SP you can check for the system variable @@error anfter any
statement to see if an error has occured. i.e.

DELETE FRom blah blah ...
IF @@error <> 0
   BEGIN
        GOTOT ERROR_EXIT
   END
..
..
..
..
..
..
..
PROCEDURE_EXIT:
RETURN 0

ERROR_EXIT:
RETURN @@error

This will return the error code to your SP in the cfstatuscode.  Remember in
the error handler in the SP to fully "clean-up" - i.e. if you are using
explcit transactions you will need to rollback/committ accordingly


-----Original Message-----
From: Bosky, Dave [mailto:[EMAIL PROTECTED]
Sent: 20 June 2003 13:01
To: SQL
Subject: Confirm a successful execution of a query?


I'm using MS SQL 2000 stored procedures for updating/deleting records on my
website.
When I call a SP that updates/deletes a specific record is there any way to
verify the record was actually updated/deleted?
Is there a certain variable I can check that SQL uses as a flag to indicate
whether a query was successful or not?

Thanks,
Dave




HTC Disclaimer:  The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of this
message is not the intended recipient, or an employee or agent responsible
for delivering this message to the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this
communication is strictly prohibited.  If you have received this
communication in error, please notify us immediately by replying to the
message and deleting it from your computer.  Thank you.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=6
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=6

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

                        

Reply via email to