Jump to content

LIMIT for MSSQL?


ober

Recommended Posts

I know you can use the LIMIT clause in MySQL to grab a specific group of records from a MySQL table, but I'm using MSSQL and I need to do the same thing. I know about the TOP function, but I'm not sure how to go about grabbing the TOP x records starting at record y.

I have groups of 12000+ records in a table and I'm graphing all the records. They will have the option to zoom in on the graph and I need to be able to go back and grab from x to y.

Any ideas? The only other thing I was thinking of was doing some math on the ID value (auto-increment).
Link to comment
https://forums.phpfreaks.com/topic/8541-limit-for-mssql/
Share on other sites

Just in case anyone else ever digs this thread back up or searches for it, I did find an answer:

[a href=\"http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=850&lngWId=5\" target=\"_blank\"]http://www.planet-source-code.com/vb/scrip...Id=850&lngWId=5[/a]

I modified it to fit my application and it works like a charm. Obviously it's very bloated compared to the LIMIT clause, but it works.
Link to comment
https://forums.phpfreaks.com/topic/8541-limit-for-mssql/#findComment-31638
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.