When you say "SQL" do you mean MS SQL Server?  If so, SQL Server (at least
6.5, the last version I know) doesn't have a rownum.  You can either use
CFOUTPUT's startrow and rowcount abilities, or you could query for a list of
all the keys in the table, figure out using the listgetat function the key
that represents row 50 and the key that represents row 100 and requery for
the rows whose keys fall between them.

-----Original Message-----
From: Todd McFarlin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 14, 2000 6:11 PM
To: CF-Talk
Subject: RE: Oracle and SQL


Greetings again,

I'm afraid I wasn't complete in my first posting. Please allow me to expand
the situation.

I fire off a quick query to grab the number of entries in the table.
>From this number, I populate a select box based on number of
entries/50=pages.
Depending on the value from the select box, I need to pass two variables
into the SQL statement: StartRow and EndRow.
Now, the table I'm grabbing info from is constantly having entries added,
deleted, and updated. So that rules out caching
Also, we use OBDC drivers.

The BETWEEN function sounds very much like it is a starting point. But how
does one say RowNum in SQL?

-----Original Message-----
From: Todd McFarlin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 14, 2000 10:17 AM
To: CF-Talk
Subject: Oracle and SQL


Greetings,

        Being an Oracle person, I'm having a difficult time trying to make a
CFQuery work correctly in SQL.

The Problem: I have a database with thousands of rows. I need to select only
50 rows per query. The start row and end row need to be variables. Now,
Oracle has a function called RowNum. In the Where part of a query, it allows
the selection of certain rows from the table between two set
paramaters...something like select rows >=50 and <=100. This yields 50 rows
returned.

My Question: Is there a similar function in SQL, or how is this
accomplished?

My thanks,

Todd McFarlin
Celosis, Inc.
[EMAIL PROTECTED]
(510) 814-3078
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        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