Tyler is right. Using TOP is way more efficient since you aren't bringing
1000 results throught the pipeline only to use 10 of them. The only thing
about TOP is that you can't set it dynamically, as is TOP @maxrows. To do
this, use the SET ROWCOUNT @maxrows. Just be sure that after your SQL
statement you do SET ROWCOUNT 0 to reset it.

Anthony Petruzzi
Webmaster
954-321-4703
[EMAIL PROTECTED]
http://www.sheriff.org


-----Original Message-----
From: Tyler Silcox [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 02, 2002 6:56 PM
To: CF-Talk
Subject: Re: SELECT TOP n vs MaxRows...


I probably should of asked about the penalties, which I assume there aren't
any? Order clause still work, etc.

We develop mainly on MS-SQL so it'll work for at least the next couple of
projects...thanks all->

Tyler Silcox
email | [EMAIL PROTECTED]

----- Original Message -----
From: "Rob Baxter" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, May 02, 2002 6:31 PM
Subject: RE: SELECT TOP n vs MaxRows...


It would seem that TOP is more efficient because you're dropping the extra
rows on the sql side instead of the cf side, thereby saving yourself some
resources on the recordset transfer.

</rob>

-----Original Message-----
From: Tyler Silcox [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 02, 2002 6:32 PM
To: CF-Talk
Subject: SELECT TOP n vs MaxRows...


A quickie: Is there any benefit to using SELECT TOP n vs using the MaxRows
attribute in cfquery?

Tyler Silcox
email | [EMAIL PROTECTED]





______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to