ROW_NUMBER() in a view in SQL Server 2005

2019-09-02 07:04发布

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条回答
对你真心纯属浪费
2楼-- · 2019-09-02 07:31

The problem was the view wizard.
What I learned: never use the wizards when you can code! :)

查看更多
登录 后发表回答