Click here to Skip to main content
15,914,074 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi to all,

i would like to know whether there is way to get selected rows with their row number as column

for example

select job_desc from jobs where max_sal>20;

it will result 20 rows

now i would like get the rows along with their row number as column

such as

rowN0            job_desc
-----              ---------  
1                 manager
2                 sales man
3                 programmer
.................. 


is it possible in SQL?

if not, please tell me the its equivalent C# code.
Posted
Updated 14-Jan-10 3:18am
v2

You might like to take a look here [^]
 
Share this answer
 
please try this sql query man

SQL
SELECT * FROM
( SELECT
    ROW_NUMBER() OVER (ORDER BY job_desc ASC) AS SNo,
    job_desc
  FROM jobs
) jobs
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900