不用删除的,可以这样做举个例子
--将数据库设为单用户模式
USE master
EXEC sp_dboption 'pubs', 'single user', 'TRUE'
go--重建表索引
use pubs
dbcc checktable('authors',REPAIR_REBUILD)
go
--将数据库设为单用户模式
USE master
EXEC sp_dboption 'pubs', 'single user', 'TRUE'
go--重建表索引
use pubs
dbcc checktable('authors',REPAIR_REBUILD)
go
if exists(select * from sysindexes where name='ix_group_fgroupid')
drop index [t_group].[ix_group_fgroupid]
go
--新建索引
create index ix_group_fgroupid on t_group(fgroupid)
--具体的表进行重建索引:
DBCC DBREINDEX (t_group)