question

SSIS_Partition avatar image
SSIS_Partition asked

Load data into Partition Table

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? My table is partitioned by month using acquisition date and I receive data feed which can have 3 to 4 months of data. How do I use ALTER SWITCH to load this data into actual partition table? Appreciate your help in advance! Thanks,
partition
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Wilfred van Dijk avatar image
Wilfred van Dijk answered
See this excellent resource about partitioning: http://www.brentozar.com/sql/table-partitioning-resources/ (I recommend the video tutorials)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.