USE [User_DB]
GO
BEGIN TRANSACTION
## -- 1、创建分区函数
CREATE PARTITION FUNCTION [knowPartitionFunc](datetime)
AS RANGE
LEFT FOR VALUES (N'2014-01-01T00:00:00', N'2014-02-01T00:00:00', N'2014-03-01T00:00:00')
## -- 2、创建分区解决方案
CREATE PARTITION SCHEME [konwPartitionSolution]
AS PARTITION [knowPartitionFunc] TO ([PRIMARY], [know1], [know2], [know3])
## -- 3、创建索引
CREATE CLUSTERED INDEX [ClusteredIndex_on_konwPartitionSolution_635706905441367386]
ON [dbo].[test]
(
[time]
)WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF)
ON [konwPartitionSolution]([time])
## -- 4、删除索引
DROP INDEX
[ClusteredIndex_on_konwPartitionSolution_635706905441367386]
ON [dbo].[test] WITH ( ONLINE = OFF )
COMMIT TRANSACTION