Cheers. I can't say I've ever used it in cfquery, but it's in my SP
templates.

I could have sworn there was another reason for using it but I can't think
what it is right now.

Ade

-----Original Message-----
From: Jim Wright [mailto:[EMAIL PROTECTED]
Sent: 23 January 2006 12:21
To: CF-Talk
Subject: Re: Update, Delete, Insert recordcount?


Mainly, it is a performance thing...when you have multiple statements
returning their counts, it takes longer to get to that one statement
that actually has the results you want.    It may be milliseconds, but
in some systems, that can add up...so it's just good practice.  Also,
I have read that not having "set nocount on" can mess up CF's ability
to parse out an error message from the messages that are returned, as
it gets confused by the multiple count messages that may precede the
error....but I haven't confirmed that one myself.

But there is probably no problem using it on a single statement.

On 1/22/06, Adrian Lynch <[EMAIL PROTECTED]> wrote:
> Why multiple statements, why not single statements?
>
> Ade
>
> -----Original Message-----
> From: Jim Wright [mailto:[EMAIL PROTECTED]
> Sent: 22 January 2006 01:08
> To: CF-Talk
> Subject: Re: Update, Delete, Insert recordcount?
>
>
> Also always a good idea to use SET NOCOUNT around multiple SQL
> statements to suppress informational messages...
> <cfquery name="yourQuery" datesource="yourDS">
> SET NOCOUNT ON
>
> UPDATE yourTable
> SET YourColumn = 'Something'
>
> SELECT @@ROWCOUNT  AS RowsUpdated
>
> SET NOCOUNT OFF
> </cfquery>
>
>
> On 1/21/06, Adrian Lynch <[EMAIL PROTECTED]> wrote:
> > My name's not Bobby, but here goes:
> >
> > <cfquery name="yourQuery" datesource="yourDS">
> >         UPDATE yourTable
> >         SET YourColumn = 'Something'
> >
> >         SELECT @@ROWCOUNT 'RowsUpdated'
> > </cfquery>
> >
> > <cfoutput>
> >         #yourQuery.RowsUpdated#
> > </cfoutput>
> >
> > Untested, and for SQL Server, but might be ok for Access.
> >
> > Adrian


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230217
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to