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 2012 Forums
 Transact-SQL (2012)
 Update Statistics with where clause

Author  Topic 

Kishh143
Starting Member

2 Posts

Posted - 2014-11-20 : 00:33:18
Hi

I have a problem updating statistics. Firstly I have generated schema from the database and tried to recreate the database in the different server. But unfortunately my script is failing at the update statistics with filter(where clause in the update statistics) please refer to the generated sql script below. Is there any workaroud to update the statistics without any error

UPDATE STATISTICS [dbo].[tl_om_polsmappingdata_polineshipment]([tl_om_polsmappingdata_polineshipment_update_obj_customer_org_id_fx])
WHERE ([update_obj]=(1))
WITH STATS_STREAM = binartdata, ROWCOUNT = 54, PAGECOUNT = 1


Kish

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-11-20 : 11:29:53
WHERE is not available on the UPDATE STATISTICS command:

http://msdn.microsoft.com/en-ca/library/ms187348.aspx
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-11-20 : 11:38:39
You can create a filtered index (WHERE clause on an index) and then update stats on that index to achieve similar to what you posted about. I am not sure why you are trying to do this though.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -