Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2003
    Posts
    19

    Red face Unanswered: How to return only the first row....

    Is there a way to return only the first row of a multi-row query. In other words... I have a query returning multiple rows but I want it to stop after it retrieves the first row.

    Thanks

  2. #2
    Join Date
    Jul 2002
    Posts
    29
    In Oracle you would add

    AND ROWNUM = 1

    to the WHERE clause

    -- rajXesh
    All you need in this life is ignorance and confidence, and then success is sure.
    -- Mark Twain (1835 - 1910)

  3. #3
    Join Date
    Jan 2003
    Posts
    19
    Thanks rajXesh!

  4. #4
    Join Date
    Jan 2003
    Location
    Pittsburgh, PA
    Posts
    86

    Question

    Is there a similar command for SQL Server?

  5. #5
    Join Date
    Jan 2003
    Location
    Baltimore; Washington DC
    Posts
    1
    Originally posted by acg_ray
    Is there a similar command for SQL Server?
    SELECT TOP 1 * FROM [table]

  6. #6
    Join Date
    Jan 2003
    Location
    Pittsburgh, PA
    Posts
    86

    Thx

    Thx Joel. That did it.

Posting Permissions

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