I had a query I ran in SQL2000 to defrag indexes. I've since upgraded to SQL2005 and thought I had fixed the query so it would work. I'm getting this error now:Msg 102, Level 15, State 1, Line 15
Incorrect syntax near '('.
I know the error points to the text right after "ALTER INDEX REORGANIZE" but if I modify that to remove it, I continue getting similar messages, always with the text following that line. Below is the query I'm trying to run. Any help
is greatly appreciated, as I am not too familiar w/SQL Queries.
DECLARE @Db AS VARCHAR(50)
--name of the database
DECLARE @Table AS VARCHAR(500)
DECLARE @Index AS VARCHAR(500)
DECLARE CurMain CURSOR FOR SELECT o.name, i.name from sysindexes i
INNER JOIN sysobjects o ON o.id=i.id where indid > 0 and indid < 255 and o.xtype='U'
FETCH NEXT FROM CurMain INTO @Table, @Index
WHILE @@Fetch_Status = 0
View Complete Post