Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Limiting the number of records to be displayed SQL Server

    I am trying to write a SELECT statement that limits the number of records to be shown. I want to use the LIMIT command since it seems so simple to use however for some reason, I am getting a syntax error when I do...The SELECT statement is "SELECT title, eventDate, startTime, endTime, location, short FROM events LIMIT 3,2" and the error is Incorrect syntax near 3.

    Does anyone know why this is creating an error?

    Any information would be greatly appreciated.

    Thank you!
    Jen

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    SQL server does not have the 'limit' clause like mysql does, you'll have to use the TOP clause in sql server.
    Select TOP 5 fldName from tblName

    Good luck

  • #3
    New Coder
    Join Date
    May 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thank you very much.

    Thanks a lot Brando, that worked great!!
    Jen


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •