SQLTeam.com | Weblogs | Forums

NULL Update Statistics


#1

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


#2

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


#3

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.


#4

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


#5

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
go

yourscriptgoeshere