在SQL2005以上可以使用Row_Number()来获取行号,SQL2000中没有这个函数,我们可以用下面的方法来获取行号:
select
(
select
count
(
*
)
from tb_product p1
where p1.proid <= p2.proid) as rowNumber,
* from tb_product p2
order by rowNumber
from tb_product p1
where p1.proid <= p2.proid) as rowNumber,
* from tb_product p2
order by rowNumber