Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.