• FYI, for anyone interested, I did get it to work. I had to deviate from the way that Kimberly Tripp had said to do it, but at least it works. Instead of the final partition being created on Primary, it had to be created on a real filegroup that is eventually going to be utilized. After the final partition is split, the [now] last partition is the one on the filegroup that was indicated as "next used". Here is the new successful code for the Range Right 12-month sliding window update (without repeating all the creation scripts already presented above -- just showing additional or changed code):

    Also Note: This code is dynamic in the sense that it was automatically generated from within a script. I just did a whole lot of print statements for the dynamic sql that was being created to get the resulting script for testing...

    ALTER DATABASE edw ADD FILEGROUP [201101]

    ALTER DATABASE edw

    ADD FILE

    (NAME = '201101',

    FILENAME = 'H:\mssql\data\201101.ndf',

    SIZE = 65000MB,

    MAXSIZE='UNLIMITED',

    FILEGROWTH = 100MB)

    TO FILEGROUP [201101]

    CREATE PARTITION FUNCTION dispense_date_pfn(date)

    AS

    RANGE RIGHT FOR VALUES (/*'2009',*/ '20100201','20100301','20100401','20100501','20100601','20100701','20100801','20100901','20101001','20101101','20101201', '20110101')

    -- Create partition scheme

    CREATE PARTITION SCHEME dispense_date_pscheme

    AS

    PARTITION dispense_date_pfn

    TO (/*[2009],*/[201001],[201002],[201003],[201004],[201005], [201006], [201007], [201008], [201009], [201010], [201011], [201012], [201101])

    ALTER DATABASE edw ADD FILEGROUP [201102]

    ALTER DATABASE edw ADD FILE (NAME = '201102', FILENAME = 'H:\mssql\data\201102.ndf',

    SIZE = 65000MB, MAXSIZE='UNLIMITED', FILEGROWTH = 100MB) TO FILEGROUP [201102]

    CREATE TABLE [dbo].[fill_fact_add]

    ( time_key int not null,

    chain_key int not null,

    patient_key int not null,

    pharmacy_key int not null,

    drug_key int not null,

    dispense_date date not null,

    CONSTRAINT dispense_date_add_chk_con

    CHECK ([dispense_date] >= '20110101'

    AND [dispense_date] < '20110201')

    ) ON [201101]

    CREATE TABLE [dbo].[fill_fact_drop]

    ( time_key int not null,

    chain_key int not null,

    patient_key int not null,

    pharmacy_key int not null,

    drug_key int not null,

    dispense_date date not null)

    ON [201001]

    ALTER TABLE fill_fact SWITCH PARTITION 1 to fill_fact_drop

    ALTER PARTITION FUNCTION dispense_date_pfn() MERGE RANGE('20100201')

    ALTER PARTITION SCHEME dispense_date_pscheme NEXT USED [201102]

    ALTER PARTITION FUNCTION dispense_date_pfn() SPLIT RANGE ('20110201')

    ALTER TABLE fill_fact_add SWITCH TO fill_fact PARTITION 12

    DROP TABLE fill_fact_drop

    DROP TABLE fill_fact_add

    --the following doesn't work yet -- there seems to be stuff sticking around in this File/FG...

    ALTER DATABASE edw REMOVE FILE [201001]

    ALTER DATABASE edw REMOVE FILEGROUP [201001]