In this article we will look into how to write a sql query to get a particular row in sql.

Lets write the code to find 2nd row in a table named mcc_measures.

So first we declare a temporary table

declare @temp table (id int) 

No in this temp table we insertrow numbers of the table


insert into @temp(id)

SELECT 
ROW_NUMBER() over(ORDER BY Measure_Id DESC)
FROM 
mcc_measures

Now from the temp table we select the row where rowid=2 as required

SELECT
*
FROM
@temp
WHERE
id = 2

kick it on DotNetKicks.com

Shout it

pimp it

Anky Goyal

I am MCPD certified in .NET and working on .NET technologies for past 3yrs. I am very passionate about the new features which get introduced in the technology. I am here to share the new features i get to know in the world of Microsoft. Follow me on twitter @ankygoyal LinkedIN@Ankit Goyal

More Posts - Website

  • Pingback: DotNetBurner - SQL Server

  • Pingback: DotNetShoutout

  • Pingback: PimpThisBlog.com

  • http://www.google.com KattyBlackyard

    Original post by Dmitri Gromov

    • http://www.linkedin.com/in/ankitgoyal Ankit Goyal

      Hi KattyBlackYard,

      Well the query written above is very basic query and i do not know what Dmitri Gromov has written on the topic.
      Please provide me the URL of the article you are talking of, so that i can send pingbacks to it.

  • http://sjwak2gozzzzzzzzzzzzwl.edu fkawau

    This is the turn Query to get a particular row in Sql Server 2005 | Techartifact blog for anyone who wants to seek out out most this content. You observation so more its near debilitating to converse with you (not that I really would want…HaHa). You definitely put a new twirl on a theme thats been holographic most for years. Prissy block, only great!

  • http://pointdroidapps.blogspot.com/ Free Point android apps

    This is the penalize Query to get a particular row in Sql Server 2005 | Techartifact diary for anyone who wants to essay out out almost this matter. You mention so often its nigh effortful to contend with you (not that I real would want…HaHa). You definitely put a new rotation on a matter thats been cursive roughly for years. Squeamish shove, simply eager!

  • http://tomtomandroiddownload.blogspot.com/ tomtom android download

    Wow, superb blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your site is great, let alone the content!. Thanks For Your article about Query to get a particular row in Sql Server 2005 | Techartifact .

  • http://www.warriorforum.com/ MMO

    Simply wanna comment on few general things, The website design is perfect, the articles is real wonderful. “The sun sets without thy assistance.” by The Talmud.

  • http://www.justiciaparaputis.org/ read more

    I like this site very much, Its a rattling nice place to read and incur information. “The absence of war is not peace.” by Harry S Truman.

  • http://www.mesotheliomabooks.org/ mesothelioma information on-line

    Keep up the good work , I read few articles on this website and I conceive that your site is real interesting and has sets of good info .