我正在运行来自 SQLFOOL 和 SQL Authorities 等的不同脚本,但是当我检查数据库时,我根本看不到任何碎片整理。我写了一些代码不起作用,你能帮帮我吗?
Declare @table_name Varchar (70);
Declare table_cursor Cursor for
select OBJECT_SCHEMA_NAME([OBJECT_ID])+'.' + NAME AS Tablenamee
from sys.tables
open table_cursor
Fetch next from table_cursor into @table_name
While @@fetch_status = 0
begin
Alter index all on @table_name
REBUILD WITH (FILLFACTOR=80, ONLINE=ON)
fetch next from table_cursor into @table_name
end
Close table_cursor
deallocate table_cursor
得到错误
@table_name 附近的语法不正确