Hi Everyone,
------------------------------------------------------------------------
------------------------------------------------------------------------
-------------------------------
"Msg 169, Sev 15: A column has been specified more than once in the
order by list. Columns in the order by list must be unique. [SQLSTATE
42000]"
------------------------------------------------------------------------
------------------------------------------------------------------------
-------------------------------
This is the error I get when I try to execute the below re-indexing
script:
------------------------------------------------------------------------
---
DECLARE @TableName varchar(255)
DECLARE TableCursor CURSOR FOR
SELECT table_name FROM information_schema.tables
WHERE table_type = 'base table'
OPEN TableCursor
FETCH NEXT FROM TableCursor INTO @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @TableName
DBCC DBREINDEX(@TableName,' ',90)
FETCH NEXT FROM TableCursor INTO @TableName
END
CLOSE TableCursor
DEALLOCATE TableCursor
------------------------------------------------------------------------
--
Any Ideas?
Thanks
Gaurav
MS Sql Server LazyDBA home page