其实之前做过类型的验证,不过影响不是特别深,只是记得不会改变DATA COMPRESSION,那今天再次遇到这个问题就再拿出来验证一下。随便写个脚本验证下。ALTER INDEX ... REBUILD没有改变例子中表的PARTITION SCHEME和DATA COMPRESSION。
CREATE PARTITION FUNCTION myRangePF1 (int) AS RANGE LEFT FOR VALUES (1, 100, 1000); GO CREATE PARTITION SCHEME myRangePS1 AS PARTITION myRangePF1 TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY]); GO CREATE TABLE dbo.table5 ( col1 INT, col2 DATETIME DEFAULT(GETDATE()) ) ON myRangePS1(col1) WITH(DATA_COMPRESSION=PAGE) CREATE INDEX IX_dbo_table5_col1 ON dbo.table5(col1) WITH (DATA_COMPRESSION=PAGE) ON myRangePS1(col1) ALTER INDEX IX_dbo_table5_col1 ON dbo.table5 REBUILD SELECT * FROM sys.partitions WHERE object_id = object_id('table5') and index_id NOT IN (0,1)