我在Sql Server 2012中有一個表Categ12_Items
,它具有創建的用戶定義索引。這些被命名爲index1,index2,index3,index4,index5, index6,index7, index8, index9, index10
。這僅僅是一個例子,最後一個索引可以是index10或index11或index55或index100,這意味着從索引5開始可以創建任意數量的索引,這些索引將始終按順序命名。刪除SQL Server 2012中的表的用戶定義索引
重新填充表數據時,不必刪除從索引1到索引4的前4個索引,但需要刪除並重新創建從索引5開始的所有其他索引。
我的問題是如何刪除從索引5開始的所有索引。當然,我可以像下面的T-SQL一樣使用drop個別索引,但我試圖用一個語句來完成。可能是系統定義的存儲過程,我無法找到。
問題:是否有系統定義的存儲過程將刪除表上的多個索引?
DROP INDEX index5 on Categ12_Items;
DROP INDEX index6 on Categ12_Items;
DROP INDEX index7 on Categ12_Items;
DROP INDEX index8 on Categ12_Items;
DROP INDEX index9 on Categ12_Items;
DROP INDEX index10 on Categ12_Items;