Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Issue with partitioned view

Author  Topic 

jsfoster
Starting Member

1 Post

Posted - 2004-10-26 : 12:15:56
I'm querying a partitioned view which functions as expected when using SELECT * or SELECT TOP N * and the WHERE clause identifies the constraint. My problem is that as soon as I include an aggregate in the SELECT, the query optimizer reverts to scanning the entire view and not the partition. I've been troubleshooting this without luck and searched MSDN. There are plenty of examples of querying partitioned views, but I have found zero examples of querying partitioned views where an aggregate is involved. ANY advice or recommendations are highly appreciated!

nr
SQLTeam MVY

12543 Posts

Posted - 2004-10-26 : 12:29:50
Try accessing the view in a derived table and use the aggregate on that.
If that doesn't work use a temp table or table variable.

Not very good but might help in the short term.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -