You can also check @@ROWCOUNT to see how many rows were affected by your
query. Frequently, I will do something like this:
DECLARE @RowsAffected int
..
INSERT / UPDATE / DELETE query #1
SET @RowsAffected = @@ROWCOUNT
INSERT / UPDATE / DELETE query #2
SET @RowsAffected = @RowsAffected + @@ROWCOUNT
..
..
etc.
"Andy Ewings" <[EMAIL PROTECTED]>
06/20/2003 08:08 AM
Please respond to sql
To: SQL <[EMAIL PROTECTED]>
cc:
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
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics.
http://www.fusionauthority.com/signup.cfm