| Author |
Topic |
|
monty
Posting Yak Master
130 Posts |
Posted - 2008-08-12 : 14:11:22
|
| hi gurus,i am trying to put together this script for updating stastics but some thing i am missing out can any one plese help outSET NOCOUNT ONDECLARE @dbid int, @DBName sysname, @SQL nvarchar(4000), @version char(1)SELECT @dbid = 5, @version = CONVERT(char(1), SERVERPROPERTY('ProductVersion'))IF @version <> '9'BEGIN WHILE @dbid < (SELECT MAX(dbid) FROM master.dbo.sysdatabases WHERE dbid > @dbid AND status & 32 = 0) BEGIN SELECT TOP 1 @dbid = dbid, @DBName = name FROM master.dbo.sysdatabases WHERE dbid > @dbid AND status & 32 = 0 ORDER BY dbid SET @SQL = ([' 'use'+ @DBName + '])''sp_updatestats'' EXEC sp_executesql @statement = @SQL ENDENDits me monty |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
monty
Posting Yak Master
130 Posts |
Posted - 2008-08-12 : 14:25:27
|
| thanks for the reply tara,what i am actaully looking for is that sp should take of the parametres something like your checkdb sp.. i dont want to pass any i/p parametres all db's and tables should be taken careits me monty |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
monty
Posting Yak Master
130 Posts |
Posted - 2008-08-12 : 14:38:29
|
| must say Tara you rock much thanksits me monty |
 |
|
|
monty
Posting Yak Master
130 Posts |
Posted - 2008-08-12 : 15:01:18
|
| got a doubt Tara doesn't it show me the progress of updating in each table as it does in your checkdb scriptits me monty |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
monty
Posting Yak Master
130 Posts |
Posted - 2008-08-12 : 15:27:49
|
| the updatestats script just shows that it got executed sucessfully but when i use STATS_DATE to find out las modified stats it tells me null, i believe i am doing some thing wrong.. the checkdb script does tell me that so it hs no allocation and consiatenscy erros for each all objects..its me monty |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-08-12 : 15:31:50
|
| That's just the output of DBCC CHECKDB, and not directly from my script.I don't have an answer as to your stats issue. Add some PRINT statements to check for progress.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
|