Click to See Complete Forum and Search --> : "order by" not working in view?!


_mark_
04-05-2007, 06:20 PM
hi i'm new here and i'm hoping one of you clever people can help me with my problem!

i'm using Microsoft SQL Server Express Edition with advanced services 2005
9.0.2047

right, I may have gone crazy and I'm missing something blindingly obvious but here goes...

I have a db running on ms sql server 2005

on this db, if i create a query to manipulate data from a table - for example -

select * from tblUser order by id desc

- and then save this query as a view ,for example new_query, and then run the view with the following command -

select * from new_query

- it seems to completely ignore the "order by" part of the query and returns the results unsorted!! I have tried creating other similar views using other tables and they all ignore the "order by" section! i can kind of get round this by using the command -

select * from new_query order by id desc

- but this seems a little strange as i thought the view should do this for me?!!?

I hope that makes sense and if anyone could shed some light on this issue i will be forever in you debt,

If anyone needs any more info let me know,

Kind Regards,

Mark