Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RecNo() from MSSQL?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00576936
Message ID:
00576952
Vues:
16
>I am trying to figure out how to get a set of rows/records from MSSQL. This is for a nightly batch process where I need to grab just chunks of the table at a time. If this was VFP I would
> "select * from table where recno() between 1 and 4000"
>and then
> "select * from table where recno() between 4001 and 8000"
>What is the MSSQL equivalent?
>
>Thanks.

There really isn't one. SS uses a set-basedarchitecture. You can kinda do it using TOP.
select top 4000 WITH TIES * from mytable order by someexpression

store expression from last record in result set

select top 4000 WITH TIES * from mytable where expression > storedexpression order by someexpression
It's not exact because the WITH TIES keywords will cause SS to return rows with the same value as that of the last row in the set. You could get more than 4000 records in the result set.

Keep doing this until you have processed all the records.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform