实例:
select row_number() over(order by num desc) row_id,* from tb1
外加一些获取表信息的代码:
exec sp_helpindex @tbname
exec sp_pkeys @tbname