STATS_DATE

Transact-SQL Reference

Transact-SQL Reference

STATS_DATE

Returns the date that the statistics for the specified index were last updated.

Syntax

STATS_DATE ( table_id , index_id )

Arguments

table_id

Is the ID of the table used.

index_id

Is the ID of the index used.

Return Types

datetime

Remarks

System functions can be used in the select list, in the WHERE clause, and anywhere an expression is allowed.

Examples

This example returns the date of the last time that the statistics were updated for the specified object.

USE master
GO
SELECT 'Index Name' = i.name, 
   'Statistics Date' = STATS_DATE(i.id, i.indid)
FROM sysobjects o, sysindexes i
WHERE o.name = 'employee' AND o.id = i.id
GO

See Also

System Functions

WHERE