September 1, 2005 at 7:57 pm
Hi all,
I have a server (SQL 2000) which has some 100 odd databases on it. Now I am trying to script a job to on a weekly basis go through each database and for each table with in each database rebuild the indexes. I was hoping it would rathe rstraight forward as
declare @cmd1 varchar(500)
Set @cmd1 = EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?')"
exec sp_MSforeachdb @command1=@cmd1
but it doesnt like this. Any ideas would be great as I am sure it something simple I have missed.
Thanks
Hope this helps...
Ford Fairlane
Rock and Roll Detective
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply