Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
USE [VeryBusyDatabase];
GO
CREATE PARTITION FUNCTION [pf_MonthlyWindow] ( DATETIME2(7)) -- This data type must match your partitioning column data type exactly!
AS RANGE RIGHT FOR VALUES ( N'1900-01-01T00:00:00.000'
, N'2016-08-01T00:00:00.000'
, N'2016-09-01T00:00:00.000'
, N'2016-10-01T00:00:00.000'
, N'2016-11-01T00:00:00.000'
, N'2016-12-01T00:00:00.000'
, N'2017-01-01T00:00:00.000'
, N'2017-02-01T00:00:00.000'
, N'2017-03-01T00:00:00.000'
, N'2017-04-01T00:00:00.000'
, N'2017-05-01T00:00:00.000'
, N'2017-06-01T00:00:00.000'
, N'2017-07-01T00:00:00.000'
, N'2017-08-01T00:00:00.000'
, N'2017-09-01T00:00:00.000'
, N'2017-10-01T00:00:00.000'
, N'2017-11-01T00:00:00.000'
, N'2017-12-01T00:00:00.000'
, N'2018-01-01T00:00:00.000'
, N'2115-01-01T00:00:00.000' );
GO
CREATE PARTITION SCHEME [ps_MonthlyWindow]
AS PARTITION [pf_MonthlyWindow]
TO ( [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY]
, [PRIMARY] );
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment