Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to get 5 th record of the table using stored procedure...

How to get 5 th record of the table using stored procedure...

Scheduled Pinned Locked Moved Database
databasehelptutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sasmi
    wrote on last edited by
    #1

    Dear Bro, :confused:I want to fetch 5 the record of the table or query using Stored Procedure it is possible but i dont know how? please help me. I want to fetch the record of Employee whose Payment is Highest and on 5 th rank using Stored Procedure. Using SQL 2000 database Thanks in advanced:rose: Sasmi

    P V 2 Replies Last reply
    0
    • S Sasmi

      Dear Bro, :confused:I want to fetch 5 the record of the table or query using Stored Procedure it is possible but i dont know how? please help me. I want to fetch the record of Employee whose Payment is Highest and on 5 th rank using Stored Procedure. Using SQL 2000 database Thanks in advanced:rose: Sasmi

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      Use the TOP predicate. Select the TOP 1 record which is not in the set of TOP 4 records.

      Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

      1 Reply Last reply
      0
      • S Sasmi

        Dear Bro, :confused:I want to fetch 5 the record of the table or query using Stored Procedure it is possible but i dont know how? please help me. I want to fetch the record of Employee whose Payment is Highest and on 5 th rank using Stored Procedure. Using SQL 2000 database Thanks in advanced:rose: Sasmi

        V Offline
        V Offline
        Vipin d
        wrote on last edited by
        #3

        try this, declare @n int SET @n=5 SELECT DISTINCT (a.salary) FROM Table1 a WHERE @n=(SELECT COUNT(DISTINCT(b.salary)) FROM Table1 b WHERE a.salary<=b.slaray)

        They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!!
        CrazySanker

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups