//i have tested the below code its working correctly in sql server
try this one agin and let me know
//chnage the last pt.pty_name to pt.sl_no
Select
( select
count(*)
from
TestTable
where
pt.ID>=ID) as sl_no,
pt.Name from TestTable as pt
order by pt.ID