ORDER BY clause within a view does not work in SQL 2005

  • I'm not sure about the performance, but you can achieve order in view by using CTE

    create view vLogin

    as

    with cte as

    (

    select *

    ,rowid=row_number() over(order by loginid asc)

    from login.dbo.login

    )

    select*

    fromcte

    This is allowed and works very well!! You might want to define some specific columns rather than *.

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply