sql server - The sql command automatically creates a row number -


mytable:

 name     family -----------------        aa b        bb c        cc d        dd 

my desired output sql code(by direction select):

 row   name     family ----------------- 1            aa 2     b        bb 3     c        cc 4     d        dd 

use row_number() function, 1 of ranking functions in sql server:

with cte (    select      row_number() over(order name) row,       name,       family    tablename ) select * cte; 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -