DECLARE @index TABLE(index_name nVARCHAR(max),index_des nVARCHAR(max),index_keys nVARCHAR(max))
INSERT INTO @index
(
index_name,
index_des,
index_keys
)
EXEC sp_helpindex 'ycmis.dbo.费用表'
--游标模版
DECLARE @indexname NVARCHAR(200)
DECLARE pcurr CURSOR
FOR
SELECT index_name
FROM @index
OPEN pcurr
FETCH NEXT FROM pcurr INTO @indexname
WHILE (@@FETCH_STATUS = 0)
BEGIN
-- PRINT @indexname
DECLARE @dropindex_sql VARCHAR(800)
SET @dropindex_sql ='drop index dbo.费用表.'+@indexname
EXEC (@dropindex_sql)
----------------------------
FETCH NEXT FROM pcurr INTO @indexname
END
CLOSE pcurr
DEALLOCATE pcurr