--排序列
SELECT displayrate,ROW_NUMBER() OVER (ORDER BY displayrate desc) AS rowid
from #ListH
--临时表
IF OBJECT_ID (‘tempdb..#tCategoryTable‘) IS NOT NULL
BEGIN
DROP TABLE #tCategoryTable;
END;
CREATE TABLE #tCategoryTable( CategoryID INT );
--游标
declare @id int
declare mycursor cursor for
select id from table1
open mycursor
fetch next from mycursor into @id
while @@FETCH_STATUS = 0
begin
--sql handle
fetch next from mycursor into @id
end
close mycursor
deallocate mycursor