Alternative to STATS_DATE?

  • Anyone know if there is an alternative to STATS_DATE? I don't to use dynamic SQL for what I'm working on and have to be with in the context of the database being queried, and STATS_DATE only works while in the context of the target database ... so I'm curious to as if there is an alternative.

    Thanks

  • I doubt it's going to help, but you can call this in a cross database query. I used the example from BOL:

    SELECT 'Index Name' = i.name, 'Statistics Date' = STATS_DATE(i.object_id, i.index_id)

    FROM Adventureworks.sys.objects o

    JOIN Adventureworks.sys.indexes i ON o.name = 'Address' AND o.object_id = i.object_id;

    GO

    You can also get that info from DBCC SHOW_STATISTICS.

    Otherwise, I think you might be stuck. Sorry. Not very helpful.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply