PartitionLearning
Programmer
I have table which is partitioned by acquisition date
Table Structure (TableName : Inventory)
Vendor_Name [varchar](80) NULL,
Model_Name [varchar](80) NULL,
AcquisitionDate [datetime] NOT NULL,
Qty [bigint] NOT NULL
Partition Function For Inventory Table :
CREATE PARTITION FUNCTION [Inventory_PF_New](datetime) AS RANGE LEFT FOR VALUES
(N'2012-07-01T00:00:00.000', N'2012-08-01T00:00:00.000',
N'2012-09-01T00:00:00.000', N'2012-10-01T00:00:00.000',
N'2012-11-01T00:00:00.000', N'2012-12-01T00:00:00.000',
N'2013-01-01T00:00:00.000', N'2013-02-01T00:00:00.000',
N'2013-03-01T00:00:00.000', N'2013-04-01T00:00:00.000',
N'2013-05-01T00:00:00.000', N'2013-06-01T00:00:00.000',
N'2013-07-01T00:00:00.000', N'2013-08-01T00:00:00.000',
N'2013-09-01T00:00:00.000', N'2013-10-01T00:00:00.000',
N'2013-11-01T00:00:00.000', N'2013-12-01T00:00:00.000',
N'2014-01-01T00:00:00.000', N'2014-02-01T00:00:00.000',
N'2014-03-01T00:00:00.000', N'2014-04-01T00:00:00.000',
)
I receive daily feed flat files which can have acquisition date up to 3 months older. I need to process these files and load data to actual partition table (Inventory Table).
Using Bulk Insert/SSIS I can simply load these files into temporary table but How Do I use ALTER SWITCH to SWITCH daily received data into actual partition table? I know
The receiving partition must be empty and when I load data into temporary table I could have three months of data. So, I can't simply perform ALTER SWITCH IN.
Any thoughts How do I implement this. My requirement is to load daily received data quickly and my daily feed can have three months of data?
Appreciate your help in advance!
Thanks,
Table Structure (TableName : Inventory)
Vendor_Name [varchar](80) NULL,
Model_Name [varchar](80) NULL,
AcquisitionDate [datetime] NOT NULL,
Qty [bigint] NOT NULL
Partition Function For Inventory Table :
CREATE PARTITION FUNCTION [Inventory_PF_New](datetime) AS RANGE LEFT FOR VALUES
(N'2012-07-01T00:00:00.000', N'2012-08-01T00:00:00.000',
N'2012-09-01T00:00:00.000', N'2012-10-01T00:00:00.000',
N'2012-11-01T00:00:00.000', N'2012-12-01T00:00:00.000',
N'2013-01-01T00:00:00.000', N'2013-02-01T00:00:00.000',
N'2013-03-01T00:00:00.000', N'2013-04-01T00:00:00.000',
N'2013-05-01T00:00:00.000', N'2013-06-01T00:00:00.000',
N'2013-07-01T00:00:00.000', N'2013-08-01T00:00:00.000',
N'2013-09-01T00:00:00.000', N'2013-10-01T00:00:00.000',
N'2013-11-01T00:00:00.000', N'2013-12-01T00:00:00.000',
N'2014-01-01T00:00:00.000', N'2014-02-01T00:00:00.000',
N'2014-03-01T00:00:00.000', N'2014-04-01T00:00:00.000',
)
I receive daily feed flat files which can have acquisition date up to 3 months older. I need to process these files and load data to actual partition table (Inventory Table).
Using Bulk Insert/SSIS I can simply load these files into temporary table but How Do I use ALTER SWITCH to SWITCH daily received data into actual partition table? I know
The receiving partition must be empty and when I load data into temporary table I could have three months of data. So, I can't simply perform ALTER SWITCH IN.
Any thoughts How do I implement this. My requirement is to load daily received data quickly and my daily feed can have three months of data?
Appreciate your help in advance!
Thanks,