I have a script that runs and fails as we have columnstore indexes
UPDATE STATISTICS failed because statistics cannot be updated on a columnstore index. UPDATE STATISTICS is valid only when used with the STATS_STREAM option. [SQLSTATE 42000] (Error 35337) 1 UPDATE STATISTICS sometable CCI__abc WITH FULLSCAN [SQLSTATE 01000] (Error 0).
The script that is used to do the update statistics is
(OBJECT_SCHEMA_NAME(st.object_id) + '.' + OBJECT_NAME(st.object_id)) AS TableName
,st.name AS StatName
,STATS_DATE(st.object_id, st.stats_id) AS StatDate
,ps.row_count AS TableRows
FROM sys.stats st WITH (nolock)
INNER JOIN sys.dm_db_partition_stats AS ps ON st.object_id = ps.object_id
AND (ps.index_id=0 or ps.index_id=1)
The only thing I can see from here is that the st.name starts with CCI_
To not include cci indexes in the update status I could do where substring(st.name,1,3) <> 'CCI'
Is there a better way than doing the hard coding, i.e by a type or anything?