The general problems addressed by this utility are:
1. Guaranteeing that the staging table required to SWITCH in or out a partition is always created correctly ‘just in time’, with the right indexes, columns, foreign keys, and partition-specific check constraint and filegroup corresponding to the target partition of a partitioned table.
2. Ensuring that any partition management scripts stay in synch with the possible index changes or foreign key constraints of partition tables over time. Without this utility, any change to a partition table’s DDL would require an equivalent change in a TSQL-based partition management script, along with associated testing, etc.
3. Providing an easy mechanism to quickly empty a selected partition from a partitioned table with a single command-line 4. Allowing fine-tuned partition data loading – including scenarios in which you want to create a staging table and populate it, and create indexes later prior to a SWITCH in operation.
The utility must be run from the command line or within an SSIS package. Command line parameters determine behavior. You may perform one of four different functions depending on the COMMAND parameter. Additional parameters define the connection (server, integrated security, etc); database, schema, partitioned table name, etc. You have the option of identifying a partition to manage either by explicit partition number (/p:) OR by specifying a string representation of a value that can be input to the partition range function to determine a partition number (/v:).