RE: Update query record count?

2004-02-13 Thread Taco Fleur
If using MS SQL, @@ROWCOUNT will return exactly that what your after!

 
DECLARE @myVar INT

 
INSERT 

 
SET @myVar = @@ROWCOUNT

 
OR

 
INSERT 

 
SELECT @@ROWCOUNT AS myVar

 
Taco Fleur
Blog  
http://www.tacofleur.com/index/blog/
Methodology http://www.tacofleur.com/index/methodology/

Tell me and I will forget
Show me and I will remember
Teach me and I will learn 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Saturday, 14 February 2004 1:05 AM
To: CF-Talk
Subject: Update query record count?

Is there a way to see how many (if any) records an update query has updated 
after it runs? Recordcount doesn't work.. Is there a way without doing
another 
query?

Thanks,

Chris 
  _
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Update query record count?

2004-02-13 Thread Smith, Matthew P -CONT(CSC)
as long as you are using a db that supports multiple sql statements per cfquery tag, you really aren't killing your db that bad.  move it to a stored proc and you are really g2g.

I had an app using a self-referncing table that had to do ton of recursive loops with recordsets looping and doing a couple-3 queries for each record in the initial record set.  MS access was taking 4000+ ms for page render; ms sql with a single cfquery and a ton of sql statements and cursors and the like in a single cfquery tag was sub-100ms.

I think the biggest hit is cf making the odbc connection, especially if you have good indexes and a cached query plan(stored proc or cfqueryparam).  Can another cf guru on the list verify?

-Original Message-
From: [EMAIL PROTECTED]
To: CF-Talk
Sent: 2/13/04 9:19 AM
Subject: Re: Update query record count?

I had in working in a 2 part w/ select, but was hoping to cut down to 1
query 
since it's being hit on every page to lower the DB load if possible.
  _
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: Update query record count?

2004-02-13 Thread ChrisWD40
I had in working in a 2 part w/ select, but was hoping to cut down to 1 query 
since it's being hit on every page to lower the DB load if possible.
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: Update query record count?

2004-02-13 Thread Smith, Matthew P -CONT(CSC)
I don't believe so.  If you are using a db that supports multiple SQL comands in onf cfquery tag, you could:

1.  do a select instead of the update first
2.  set an int(say, @myRowcount to @@rowcount
3.  run your update
4.  return @myRowcount AS RecordsUpdated

This is off the top of my head and there might be a better way, but that gets you what you need.

-Original Message-
From: [EMAIL PROTECTED]
To: CF-Talk
Sent: 2/13/04 9:05 AM
Subject: Update query record count?

Is there a way to see how many (if any) records an update query has
updated 
after it runs? Recordcount doesn't work.. Is there a way without doing
another 
query?

Thanks,

Chris
  _
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]