Well, you haven't stated your database, and the solution will differ between
them, but for what its worth if you're using sqlserver, the @@rowcount
variable will give you the number of rows affected by the last statement.

You should be able to add this either inline to a cfquery (example below) or
within a stored procedure:

<cfquery datasource="" name="deleteme">
        DELETE FROM table WHERE blah = 123;
        SELECT affected = @@rowcount;
</cfquery>

<cfoutput>
Number of rows affected: #deleteme.affected#
</cfoutput>

Should work for deletes, inserts, and updates.  Again, the example is
sqlserver only.

Kevin

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Xavi
> Sent: Thursday, November 18, 2004 2:06 PM
> To: [EMAIL PROTECTED]
> Subject: [CFCDev] [off-topic] Number of registers deleted, 
> inserted, updated
> 
> 
> Sorry, this is  alittle off topic but related to databases 
> and CFCS. When you deals with database and do inserts,updates 
> and deletes sometimes is itneresting to know the number of 
> regiters affected. So how to know the number of ie registers 
> updated after an UPDATE, some function? maybe a java class 
> which acces to query metada? I dont know. CF should return 
> rows afected after insert, update and delete like select.
> 
> Anyone can help�?
> -- 
> Xavi (http://xavicl.blogspot.com)
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
> in the message of the email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
> 
> An archive of the CFCDev list is available at 
> [EMAIL PROTECTED]
> 


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at 
[EMAIL PROTECTED]

Reply via email to