To be accurate its best to use a storedproc, but if you don't want to
use it like this
<cfquery name="updatequery" datasource="whateverdsn">
update table
set column = x
where column = y
</cfquery>
<cfquery name="getrowcount" datasource=" whateverdsn ">
select @@rowcount as RecordsUpdated
</cfquery>
just be sure to wrap in a transaction.
The only bad thing about it is if the table you are updating has a
trigger that does something then you are going to get the value from the
trigger's execution. @@rowcount returns the number of rows affected by
the very last executed statement.
Hope it helps,
Nate Nelson
-----Original Message-----
From: Paul Hastings [mailto:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 4:58 PM
To: CF-Talk
Subject: Re: Detecting SQL Update success
> Is there a way to detect if a SQL update statement in <CFQUERY>
resulted
in a record being updated? I guess I would want to know the number of
rows
updated.
depends on your db, for sql server examine the @@ROWCOUNT var
immediately
after your update.
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]