问题
I have tried the following query in Microsoft SQL Server Management Studio:
select
ROW_NUMBER() OVER(ORDER BY ret_id, dep_id DESC) AS 'Row Number'
from
Round_Trip_View
and it works.
I have tried the same to create a view, and it crashed.
Any idea?
I am looking to assign a kind of id for each row in my view and I appreciate any alternative ideas :)
回答1:
The problem was the view wizard.
What I learned: never use the wizards when you can code! :)
来源:https://stackoverflow.com/questions/13280520/row-number-in-a-view-in-sql-server-2005