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 141511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:47:18+00:00 2026-05-11T07:47:18+00:00

I would need a suggestion or even a solution, how to get only the

  • 0

I would need a suggestion or even a solution, how to get only the second,third… row of a query result with high performance. I know there is the possibility of row_number(SQL Server 2005 or higher) but not for SQL Server 2000 🙁

My first try to get the fifth row was:
SELECT TOP 1 col
FROM (SELECT TOP 5 col
FROM table
ORDER BY col) q
ORDER BY col DESC

I try to explain my requirements: In my table there can be max. 5 rows for one person. But if only 4 rows for this person exists I would get a wrong result with my above query.

Any suggestions?

Any help will be appreciated!

Thx forward, Best Regards Andreas

  • 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. 2026-05-11T07:47:18+00:00Added an answer on May 11, 2026 at 7:47 am

    This should do it…

    CREATE PROCEDURE [dbo].[sp_UpdateSkills] AS BEGIN     set nocount on      declare @UserID int     declare @Skill varchar(1)     declare @SkillCount int      declare @Skill1 varchar(1)     declare @Skill2 varchar(1)     declare @Skill3 varchar(1)     declare @Skill4 varchar(1)     declare @Skill5 varchar(1)      declare csrUser cursor for         select distinct UserID         from dbo.tblSkills1         order by 1      open csrUser      fetch next from csrUser into @UserID     while (@@fetch_status = 0)     begin         declare csrSkill cursor for             select Skill             from dbo.tblSkills1             where UserID = @UserID             order by Skill          set @SkillCount = 1         set @Skill1 = null         set @Skill2 = null         set @Skill3 = null         set @Skill4 = null         set @Skill5 = null          open csrSkill          fetch next from csrSkill into @Skill         while (@@fetch_status = 0 and @SkillCount < 6)         begin             print @UserID             print @Skill              if (@SkillCount = 1)                 set @Skill1 = @Skill             else if (@SkillCount = 2)                 set @Skill2 = @Skill             else if (@SkillCount = 3)                 set @Skill3 = @Skill             else if (@SkillCount = 4)                 set @Skill4 = @Skill             else if (@SkillCount = 5)                 set @Skill5 = @Skill              set @SkillCount = @SkillCount + 1              fetch next from csrSkill into @Skill         end          close csrSkill         deallocate csrSkill          insert into tblSkills2         (UserID, Skill1, Skill2, Skill3, Skill4, Skill5)         values         (@UserID, @Skill1, @Skill2, @Skill3, @Skill4, @Skill5)          fetch next from csrUser into @UserID     end      close csrUser     deallocate csrUser END 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 61k
  • Answers 61k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer In standard SQL, you can use either USING or ON… May 11, 2026 at 9:53 am
  • added an answer .o files are objects. They are the output of the… May 11, 2026 at 9:53 am
  • added an answer Everything you have looks pretty standard - the only thing… May 11, 2026 at 9:53 am

Related Questions

I would need to create a temp table for paging purposes. I would be
I have a program in Perl I'm working on where I would need multiple
To send a serial string character to the serial port. I would need to
I need to generate a directory in my makefile and I would like to
I need to access a mysql database from c# code but I would prefer
I need to do a number of network-related things in C++ that I would
I need to maintain a legacy VB.NET web application. Data typing is, I would
What regex pattern would need I to pass to java.lang.String.split() to split a String
I need a database that could be stored network drive and would allow multiple
I'm working on a tool which would need to communitacte: send and recieve files

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.