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 2005 Forums
 SQL Server Administration (2005)
 Maintenance plan fails: Cannot create or update s

Author  Topic 

reddy_vam
Starting Member

43 Posts

Posted - 2008-11-05 : 23:10:16
Hi Folks,

The "Update Statistics Task" of Maintenance Plan is failing with a error
"Cannot create or update statistics on view "View name" because both FULLSCAN and NORECOMPUTE options are required.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly."

I am running on SQL Server 2005, sp2

I tried all the forums, but couldn't find exact solution for this issue.

Any help resolving this issue will be appriciated.

SimpleSQL
Yak Posting Veteran

85 Posts

Posted - 2008-11-06 : 00:59:29
If the view references from more than one base table, statistics have to be
created with FULLSCAN and NORECOMPUTE. SAMPLE cannot be specified in this case.
SAMPLE can be specified only when the view is based on a single table. Note that
self joins are counted as two base tables.
Go to Top of Page

panoslondon1
Starting Member

2 Posts

Posted - 2009-07-06 : 07:27:38
My view that creates the problem only references 1 table, not 2. I have 2 updates stats tasks in SSIS. 1 to update tables and another to update views.
Go to Top of Page

exOracloid
Starting Member

1 Post

Posted - 2011-05-09 : 15:19:36
I realize this is an old thread but still for the reference of whoever comes accross it in search of a workaround:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=114332

/*
Update Statistics in All User Databases
Works in SQL Server 2005 and above

BY Michael Valentine Jones

*/

declare @cmd nvarchar(max)
set @cmd = ''

-- Build command to update statistics
select @cmd = @cmd+
'
use '+quotename(a.name)+'

print ''*** Start Update Statistics for database ''+quotename(db_name())+
'' at ''+convert(varchar(30),getdate(),121)

exec sp_updatestats

print ''*** End Update Statistics for database ''+quotename(db_name())+
'' at ''+convert(varchar(30),getdate(),121)

'
from
(
select top 100 percent
aa.name
from
sys.sysdatabases aa
where
-- Exclude system database
-- Add more database names to exclude as needed.
name not in ('master','model','msdb','tempdb') and
-- Include only databases that are online
databasepropertyex(aa.name,'Status') = 'ONLINE' and
-- Include only databases that are updatable
databasepropertyex(aa.name,'Updateability') = 'READ_WRITE' and
-- Exclude databases in single user mode
databasepropertyex(aa.name,'UserAccess ') in ('RESTRICTED_USER','MULTI_USER')
order by
aa.name
) a

print '*** Start Update Statistics at '+convert(varchar(30),getdate(),121)
exec ( @cmd ) -- Execute Update Statistics commands
print '*** End Update Statistics at '+convert(varchar(30),getdate(),121)



ex-Oracloid. (kind-of. 'cause there are no "ex" true Oracle followers ;-)
Go to Top of Page
   

- Advertisement -