[dba-SQLServer] Order of data in views

Stuart McLachlan stuart at lexacorp.com.pg
Tue May 13 18:22:55 CDT 2008


On 13 May 2008 at 16:34, jwcolby wrote:

> Well, we are talking about a GroupBy Cnt query here.  The GroupBy field 
> is what is ordered on, and is specifically ordered on that field in the 
> underlying view.
> 
> Unfortunately I cannot execute the view since the view takes about 40 
> seconds to complete and MS times out in 30, which no one here has 
> managed to show me how to prevent.
> 

Enterprise Manager, select the Server, right click and select properties,  check the "query 
timeout" field on the "Connection" tab ?


> Therefore I am forced to create a query and paste the query into that in 
> a SELECT * FROM SomeView SQL statement.  Given that the view is ordered, 
> you (I) would expect a query directly based on that to be ordered unles 
> specifically reordered in some manner.  Not so for whatever reason.
> 

Use "SELECT TOP (99.9999999999999) PERCENT..."
see
http://executioniseverything.blogspot.com/2007/01/order-by-in-views-sql-server-2005.html





More information about the dba-SQLServer mailing list