SQLTeam.com | Weblogs | Forums

NULL Update Statistics


Has anyone had issues updated a stats that would not change from a null value?


I don't understand what you mean. Could you elaborate?


I run this query
SELECT t.name TableName, s.[name] StatName, STATS_DATE(t.object_id,s.[stats_id]) LastUpdated
FROM sys.[stats] AS s
JOIN sys.[tables] AS t
ON [s].[object_id] = [t].[object_id]
WHERE t.type = 'u'

Some tables are null and when I try to update them its still null and does not update.


Are they, perhaps, adhoc statistics on columns, rather than statistics on Indexes?


Did you add a USE databasename to the top of your script? Otherwise, you are likely getting the wrong object_id when you have an object_id with the same value in say the master database.

use databasenamegoeshere