Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting Row No in Select query
Message
 
 
To
13/01/2002 23:52:52
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00604151
Message ID:
00604661
Views:
26
This message has been marked as the solution to the initial question of the thread.
You can use following query.
select t1.emp_name, 
(SELECT COUNT(*) FROM emp_mst a2 
  WHERE t2.emp_name + CAST( t2.emp_id AS char(10)) <= 
        t1.emp_name + CAST( t1.emp_id AS char(10)) ) AS Sequence
FROM emp_mst a1 
ORDER BY t1.emp_name + CAST( t1.emp_id AS char(10))
If 'emp_name' is unique you can remove CAST( t*.emp_id AS char(10)) ) from the query.

>Hello,
>
> i want the absolute row no while selecting the records from the table.
>e.g. Select name from Emp_mst
>so i want the o/p like
>Srl. No.        Name
>-------------------------
>1               abc
>2               xyz
>how should i do this ?????
>
>
>Thanx in advance,
>Amol
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform