• Hello,

    Partition function and scheme as below

    -- Step 1: Create Partition Functions and schema

    CREATE PARTITION FUNCTION PF_MONTHLY (DATETIME)

    AS RANGE LEFT FOR VALUES ('2014-01-01')

    -- Step 2: Create partition scheme

    print char(9)+'Create Partition Scheme'

    CREATE PARTITION SCHEME PS_MONTHLY AS

    PARTITION PF_MONTHLY ALL TO (DWH_PART)

    Create Unique Clustered Index UQ_EVENT_LOG

    On [dbuser].[EVENT_LOG](EVENT_TIME, ID)

    On PS_MONTHLY(EVENT_TIME)

    Alter Table [$(dbuser)].[event_log]

    Add Constraint [PK_EVENT_LOG]

    Primary Key NonClustered (ID)

    On [DWH_PART]