Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9286103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:20:00+00:00 2026-06-18T19:20:00+00:00

Is there an ANSI SQL compliant version of SQL SERVER’s SELECT TOP n ?

  • 0

Is there an ANSI SQL compliant version of SQL SERVER’s SELECT TOP n?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T19:20:01+00:00Added an answer on June 18, 2026 at 7:20 pm

    ANSI/ISO SQL:2003 introduced windowing functions:

    SELECT * FROM (
      SELECT
        ROW_NUMBER() OVER (ORDER BY age ASC) AS rownum,
        person_id,
        person_name,
        age
      FROM person
    ) AS foo
    WHERE rownum <= 3
    

    Microsoft SQL Server 2005 and later supports this syntax.
    http://msdn.microsoft.com/en-us/library/ms189798(v=sql.90).aspx

    ANSI/ISO SQL:2008 introduced a simpler syntax for FETCH FIRST, which may be more analogous to Microsoft/Sybase TOP syntax:

    SELECT person_id, person_name, age FROM person
    FETCH FIRST 3 ROWS ONLY
    

    Microsoft SQL Server 2012 and later supports this syntax.
    https://learn.microsoft.com/en-us/sql/t-sql/queries/select-order-by-clause-transact-sql?view=sql-server-2017#using-offset-and-fetch-to-limit-the-rows-returned

    If you’re still using Microsoft SQL Server 2000, you should read a question I posted a while back about doing "paging" style queries:
    Emulate MySQL LIMIT clause in Microsoft SQL Server 2000

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an ANSI SQL equivalent to Oracle's DECODE function? Oracle's decode function is
Is there a cross-database (at least SQL Server, Oracle, Postgre, MySQL, SQLite) way of
I've the follwing 2 versions of ANSI compliant SQL(column/table names changed to protect confidential
In SQL Server there is two schemas for metadata: INFORMATION_SCHEMA SYS I have heard
Is there an ANSI SQL alternative to the MYSQL LIMIT keyword? The LIMIT keyword
I am translating SQL Server SQL Statements into their ANSI generic equivalent at present,
Is there a tool out there that can analyse SQL Server databases for potential
Using Eclipse, working with (ANSI) C language, is there any way to view the
Why are SQL distributions so non-standard despite an ANSI standard existing for SQL? Are
I have a table in sql server 2005 which holds an ip range and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.