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 Administration (2000)
 Indexed View on SQL 2000

Author  Topic 

rjgamer
Starting Member

8 Posts

Posted - 2007-11-09 : 09:54:04
I have a view that I created on SQL 2000 that I also created a clustered index for. Here is what is happening, when the underlying tables have data and I create the view, it works fine - no problems. However, when the underlying tables have no data I get the following error message:

An index cannot be created on the view 'v_indexed' because the view definition includes an unknown value (the sum of a nullable expression).

This normally wouldn't be a problem since I could just create the index after the tables have been populated. However, we are rolling this out for a customer who can populate the tables at any time. I would hate to give them an additional script to run once they run their initial import if possible.

Any ideas?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-11-09 : 12:30:58
try changing the sum(yourColumn) to sum(isnull(yourColumn, 0))

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page
   

- Advertisement -