cancel
Showing results for 
Search instead for 
Did you mean: 

update statis every week

Former Member
0 Kudos

Hi Expert

Is there any command or way to update my old statistic dates every week

instead of selecting the table and view and run it manually

regards

Pp

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

U can schedule this action weekly from DB13 ..UpdateStats...No manual intervention required.

Former Member
0 Kudos

Hi Bidwan

I know with DB13 you can update stats but I can update only DBCheck but what about statistic dates eg db02-> analysis details -> enter the table and run manual statistics to change the statistic dates , I need to update statistics of all tables automatically

regards

former_member193399
Active Participant
0 Kudos

I usually keep the default settings on the database "update statistics" to on. This will update automatically behind the same of all the tables. But if you want to run manually try this:

Execute the following SQL in the management studio or query analyzer:

select 'update statistics ['+TABLE_SCHEMA+'].['+TABLE_NAME+'];' 
from INFORMATION_SCHEMA.TABLES 
where TABLE_TYPE='BASE TABLE'

The above will generate a result set which is nothing but a set of SQL statements to run update statistics for each table. Now copy and paste these from the results windows to the query window and execute it. I recommend running it in batch of 1000 though. Also make sure you run this in a scheduled downtime.

Alternative to this is creating a maintenance plan in SQL Server and use "update statistics task" and schedule the same.

I prefer taking backups, running dbcc checkdb and these kind of tasks to perform in the SQL Server rather than doing in the SAP. Let me know if this helps.

RT

Former Member
0 Kudos

Hi

Thanks , but this SQL statement is showing the update statistics not updating the statistics

regards

former_member193399
Active Participant
0 Kudos

Can you explain your questions in more detail?

"UPDATE STATISTICS" updates the statistics for a given table. I am not sure what you mean by updating the statistics.