Thursday, March 22, 2012

Data Retrieval

How does SQL handle data retrieval from a specific record? I want to be able
to capture 100 records from any given point in a table by sending a single
column value as a starting point.
So if I have a table with primary_key with values 1-1000 and I want to get
1-100 I can use TOP 100. If I then want 101 - 200, 201 - 300, etc, how can I
get the set(s)?
Can this be done?
Thank you,
AnthonyUse WHERE clause.
declare @.i int, @.j int
set @.i = 201
set @.j = 300
...
where pk_col between @.i and @.j;
AMB
"Anthony W DiGrigoli" wrote:

> How does SQL handle data retrieval from a specific record? I want to be ab
le
> to capture 100 records from any given point in a table by sending a single
> column value as a starting point.
> So if I have a table with primary_key with values 1-1000 and I want to get
> 1-100 I can use TOP 100. If I then want 101 - 200, 201 - 300, etc, how can
I
> get the set(s)?
> Can this be done?
> Thank you,
> Anthony

No comments:

Post a Comment