Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2006
    Posts
    119

    Unanswered: Equivalent in SQL server.

    DB2 has syntax FETCH FIRST which can be used to get n number of rows and hence speed of queries. Anybody know what the equivalent is in SQLServer?

    Thanks

  2. #2
    Join Date
    Aug 2008
    Location
    India
    Posts
    55
    Example :
    SELECT TOP 10 SalesOrderID, OrderDate FROM Sales.SalesOrderHeader
    ORDER BY OrderDate DESC

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Leave the ORDER BY out, if you want it to truly return records right away....
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Jan 2009
    Location
    United Kingdom
    Posts
    77
    If you leave out the ORDER BY , don't you run the risk of not ensuring the same recordset is returned every time?

  5. #5
    Join Date
    Apr 2008
    Location
    Along the shores of Lake Michigan
    Posts
    242
    If someone adds a new sales order, you wouldn't get the same dataset either, correct?

Posting Permissions

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