September 23, 2007 at 2:07 pm
Comments posted to this topic are about the item DB Reindex all Databases
May 5, 2009 at 4:40 pm
I would suggest two changes where you declare the cursor:
declare db cursor for
select name from master.dbo.sysdatabases
where name not in ('master','tempdb')
and charindex('-',name) = 0
and version 0
Checking the version prevents trying to reindex an offline database, the charindex prevents processing of databases that contain a dash in their name: the code would otherwise fail. This is for SQL Server 2000, I'm not sure if it would be implemented the same way in later versions.
-----
[font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy