Sql Server 2012 Enterprise (2024)
-- Create clustered columnstore index on error log (Enterprise 2012+) CREATE CLUSTERED COLUMNSTORE INDEX CCI_ErrorLog ON dbo.ErrorLog WITH (MAXDOP = 4, COMPRESSION_DELAY = 0); GO -- Create partitioned table (Enterprise feature) CREATE PARTITION FUNCTION pf_DateRange (DATETIME) AS RANGE RIGHT FOR VALUES ( '2024-01-01', '2024-04-01', '2024-07-01', '2024-10-01', '2025-01-01' ); CREATE PARTITION SCHEME ps_DateRange AS PARTITION pf_DateRange ALL TO ([PRIMARY]);
SET @ObjectID = OBJECT_ID(@SchemaName + '.' + @TableName); sql server 2012 enterprise
-- Get max partition number SELECT @MaxPartition = MAX(partition_number) FROM sys.partitions WHERE object_id = @ObjectID; -- Create clustered columnstore index on error log