@@Rowcount is overwritten as soon as you execute the next query.
So, it might be wise to do something like the following:
declare @MyRowCount int
'Your first query here'
set @MyRowCount = @@RowCount
if @MyRowCount = 0
begin
'Your second query here'
end
This is especially useful if you need to refer to the rowcount in more than
one place.
My $.25 worth...
Shawn Grover
-----Original Message-----
From: Andy Ewings [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 13, 2001 10:56 AM
To: CF-Talk
Subject: RE: Stored Proc Question
First Query here
IF @@rowcount = 0
BEGIN
-- Second query here
END
------------------------------------------------------------------
Andrew Ewings
Project Manager
Thoughtbubble Ltd
http://www.thoughtbubble.net
------------------------------------------------------------------
United Kingdom
http://www.thoughtbubble.co.uk/
Tel: +44 (0) 20 7387 8890
------------------------------------------------------------------
New Zealand
http://www.thoughtbubble.co.nz/
Tel: +64 (0) 9 488 9131
------------------------------------------------------------------
The information in this email and in any attachments is confidential and
intended solely for the attention and use of the named addressee(s). Any
views or opinions presented are solely those of the author and do not
necessarily represent those of Thoughtbubble. This information may be
subject to legal, professional or other privilege and further distribution
of it is strictly prohibited without our authority. If you are not the
intended recipient, you are not authorised to disclose, copy, distribute, or
retain this message. Please notify us on +44 (0)207 387 8890.
-----Original Message-----
From: John Barleycorn [mailto:[EMAIL PROTECTED]]
Sent: 13 August 2001 17:49
To: CF-Talk
Subject: Stored Proc Question
Hello, i'm running a stored proc that contains two queries. if the first
query runs and does not return records, i need to run the second query. Can
anyone tell me the equivilent of recordCount in Transact-SQL? Thanks.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists