I think the issue is with the result set. A normal CFQUERY block can only
return one result set.  Therefore if you stick it on top it will return that
result, but if you stick it below another query it will not return the
results.  Inserts/Updates/Deletes still occur and work, if they run after
another query, because they dont' really need to return a result set.

So in your case the statement SELECT @@ROWCOUNT as RowsAffected really does
run and CFQUERY really does capture the result set, it just doesn't know to
return or better said it doesn't know which query name to assign the output
to.

I would suggest using a Stored Procedure instead.  Stored procedures allow
you to return more than one results set.

Write your stored procedure and run it using <CFSTOREDPROC> and then use
<CFPROCRESULT> to return the different result sets as two seperate query
results.

Good Luck,
Mark


-----Original Message-----
From: Todd Ashworth [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 01, 2000 3:23 PM
To: CF-Talk
Subject: Re: CF Does not like MSSQL7 @@ROWCOUNT


Um .. try splitting those up into 2 seperate <cfquery>s inside of a
<cftransaction>.  I don't know if it will make a difference, but won't hurt
to try.

<cftransaction>
    <cfquery datasource="#DSNOperaDW#" name="AddInvoices">
        INSERT INTO [Images_Invoice_Index] (Invoice_ID, DirPath)

        SELECT CSVTemp.Inv_ID, CSVTemp.DIR
        FROM Images_INVPROJECT_CSVTempTable as CSVTemp
        WHERE (Doc_Type = 'I')
    </cfquery>

    <cfquery datasource="#DSNOperaDW#" name="GetGowsAffected">
        SELECT @@ROWCOUNT as RowsAffected
    </cfquery>
</cftransaction>

Todd Ashworth

----- Original Message -----
From: "Rif Kiamil" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, December 01, 2000 8:43 AM
Subject: RE: CF Does not like MSSQL7 @@ROWCOUNT


| But why does CF not pick up the
|
| Select @@RowCount as rowsaffected
|
| Unless in is at the top of the CFQUERY ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to