SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Maintenance plan fails: Cannot create or update s
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

reddy_vam
Starting Member

43 Posts

Posted - 11/05/2008 :  23:10:16  Show Profile  Reply with Quote
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

India
85 Posts

Posted - 11/06/2008 :  00:59:29  Show Profile  Reply with Quote
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 - 07/06/2009 :  07:27:38  Show Profile  Reply with Quote
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 Posts

Posted - 05/09/2011 :  15:19:36  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000