Err!! I can not update statistics on view!


While running update stat on a table or view if you get below error then do not panic.

Msg 1994, Level 16, State 2, Line 3




Cannot create or update statistics on view "Table/View Name " because both FULLSCAN and NORECOMPUTE options are required.




Mostlikely you got this message because the table/view where you are trying to update stat does not have any index/statistics only. The easiest solution I would recommend is to use sp_updatestats instead which will automatically update only the required statisics with default sample ratio. However there may be other options if you are really unable to update statistics on the entire database. Click here if you are interested into the steps on how to resolve this situation.
Na matter how you resolve it, as a DBA you should be interested to know about the view/table more. If you got it from SSIS/SQL Server mainteaince plan, be sure to fix the SSIS or otherwise mainteaince may again fail. Replacing the default update statistics code by sp_updatestatistics will be possibly the best option in mainteaince plan because it is safe to assume that you want to update all the (required) statistics of the database during a mainteaince window. Unfortunately SQL Server mainteaince plan does not use sp_updatestatistics even if you choose all default options while designing it. Also if you really discover a table/view without index/statistics, better chase the Application folks to have a good reason otherwise they may chase you tomorrow complaining that SQL Server is performing poorly.

Comments