-
Limiting Data
I was wondering if there is a way to select ranges of rows, for instance:
I want rows 5-10 of a database, how would i select that?
I know in MySQL you do a "limit #,#", no clue about SQL Server.
-
Limiting Data (reply)
Yes if you have identity column in the table.
------------
Chris Hilbert at 3/23/01 1:46:37 AM
I was wondering if there is a way to select ranges of rows, for instance:
I want rows 5-10 of a database, how would i select that?
I know in MySQL you do a "limit #,#", no clue about SQL Server.
-
Limiting Data (reply)
Then how do I do it?
------------
Ray Miao at 3/23/01 8:45:16 AM
Yes if you have identity column in the table.
------------
Chris Hilbert at 3/23/01 1:46:37 AM
I was wondering if there is a way to select ranges of rows, for instance:
I want rows 5-10 of a database, how would i select that?
I know in MySQL you do a "limit #,#", no clue about SQL Server.
-
Limiting Data (reply)
Let's say you have 20 rows with an Identity column called _ident seeding (1,1). That means each of your rows would have a Ident number corresponding to it's actual position (row 10 has an ident of 10). Your select would read:
select * from TABLE where _ident between 5 and 10
The problem gets a lot more complex if you have a non-sequential identity column, or none at all... In that case, I would say to use a cursor, and recurse through it until you've got the rows you need.
------------
Chris Hilbert at 3/23/01 8:48:43 AM
Then how do I do it?
------------
Ray Miao at 3/23/01 8:45:16 AM
Yes if you have identity column in the table.
------------
Chris Hilbert at 3/23/01 1:46:37 AM
I was wondering if there is a way to select ranges of rows, for instance:
I want rows 5-10 of a database, how would i select that?
I know in MySQL you do a "limit #,#", no clue about SQL Server.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|