ok, this hasn't been tested and is just off the top of my friends head
but it if it doesn't work it is pretty close to correct and you can
probably find the exact syntax online:

<cfquery name="users" ...>

delete from user where last_name = 'Smith'

select SQL%ROWCOUNT into numberDeleted FROM DUAL


</cfquery>



dual, if you are curious is kind of like this magic table in all
oracle databases that has no obvious purposes other than being handy
when you need to write a query like this and you don't have a table to
call it against.


Also a note on the SQL server version I sent earlier

> cfquery name="users" datasource="#request.dsn#">
>  SET NOCOUNT ON
>
> UPDATE user SET role = <cfqueryparam cfsqltype="cf_sql_varchar" 
> value="newrole">
> WHERE role = <cfqueryparam cfsqltype="cf_sql_varchar" value="oldrole">
>
> select @@ROWCOUNT as numberModified from USER
>
> SET NOCOUNT OFF
>
> </cfquery>

the select @@ROWCOUNT as numberModified doesn't need the "From user"
part.  by adding the "from user" you actually get back multiple rows
(one per entry in the table; so if your table has 1000 records you
will get 1000 records back, each containing just the number of rows
effected). so you should not include the FROM USER.

if your code looked like:
<cfquery name="users" ...>
  SET NOCOUNT ON

 UPDATE user SET role = <cfqueryparam cfsqltype="cf_sql_varchar"
value="newrole">
 WHERE role = <cfqueryparam cfsqltype="cf_sql_varchar" value="oldrole">

 select @@ROWCOUNT as numberModified

 SET NOCOUNT OFF
</cfquery>

you would only get one row back containing the number of rows affected.

hope this all makes sense and that it helps.

-- 
Bill
http://blog.rawlinson.us
----------------------------------------------------------
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