Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

View not sorting when queried

Status
Not open for further replies.

phildude

IS-IT--Management
Apr 16, 2001
12
0
0
US
Hello, I have a client that has a view with a top x and an order by. When you do a simple query against the view, it returns sorted, as soon as you add a where clause to your query, the sort goes away - any thoughts?
 
That would be the easy way, but our app passes in only a where clause for this particular feature, so it would require quite an effort to modify . I've never seen a situation where SQL Server would return the data unsorted, so I'm trying to figure out what is going on with the Server side, works fine for us and our other clients
 
This is a shot in the dark, but in your view with the Top X add "with ties".

Example :

select distinct top 10 with ties ... from ...

It makes sure you are getting all of your data when using the top x.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top