December 26, 2007 at 9:40 pm
why view does not allow order by clause while creating unless there is no top ?
December 27, 2007 at 4:52 am
Because the client usually dictates what the sorting will be (for a proper seperation of the data and its presentation). No need to sort it twice.
select ...
from myview
where ...
order by myclientprefferedorder
December 27, 2007 at 9:35 am
Because storage doesn't imply order. A view is simply an overlay onto storage.
Just like a table doesn't have an order, a view doesn't. Don't use views to preserve order. Use your queries.
December 27, 2007 at 3:36 pm
sudhakara (12/26/2007)
why view does not allow order by clause while creating unless there is no top ?
And that behaviour has changed with the 2005 release. Even though you can add that to the view creation script the order is *NOT* followed unless you order the results from a client query as posted above.
Cheers,
* Noel
December 28, 2007 at 11:30 pm
sudhakara (12/26/2007)
why view does not allow order by clause while creating unless there is no top ?
FYI http://sqlblog.com/blogs/tibor_karaszi/archive/2007/11/28/sorted-views.aspx
Failing to plan is Planning to fail
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply