cancel
Showing results for 
Search instead for 
Did you mean: 

SAP db - how to get the time update statistics performed on a tables?

Former Member
0 Kudos

Hi Experts

I'm using update statistics command to analyze a table and would like to know later when this table was analyzed.

I saw that in the user_tables table the num_rows coulmn was changed but the last_analyzed coulmn was not changed.

Does anyone know if last_analyzed coulmn should be changed and if so why it didn't ? or maybe there is another way to get this information for sap db ?

thanks alot,

Piroz

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member193399
Active Participant
0 Kudos

You can use the SQL Server command

"STATS_DATE ( table_id , index_id )"

to find out when the stats were updated for a particular index and table. You can find more help and detailed example on bookonline (BOL).

RT

Former Member
0 Kudos

Hi RT

I am getting error when run on SQL Query

Server: Msg 170, Level 15, State 1, Line 1

Line 1: Incorrect syntax near 'STATS_DATE ( table_id , index_id )'.

former_member193399
Active Participant
0 Kudos

Hi,

You will definitely get syntax error if you run the statement as it in my post.You need to substitute table_id and index_id parameters. More information is available in Books online. Here is the example from Books online which gives the stats date for all the indexes.

SELECT name AS index_name,

STATS_DATE(object_id, index_id) AS statistics_update_date

FROM sys.indexes

Thanks,

RT