DRAG DROP
You use SQL Server 2014 Enterprise Edition. Your database contains a partitioned table named AuditData.
AuditData is partitioned by year. Partition 1 contains data from the year 2010 and prior.
Management has decided to archive all AUDITDATA records from 2010 and prior. Management wants the
records to be removed from the database entirely and provided to the backup team as a zipped text file. The
data must no longer reside in the database. There is very little tolerance for performance degradation in your
environment.
You need to remove all 2010 and prior data from the AuditData table by using the least amount of system
resources possible.
Develop the solution by selecting and arranging the required SQL actions in the correct order.
You may not need all of the actions.
Select and Place:
Explanation:
Note:
* Create a new partitioned table with the partition function you want, and then insert the data from the old table
into the new table by using an INSERT INTO…SELECT FROM statement.
* SPLIT RANGE ( boundary_value )
Adds one partition to the partition function. boundary_value determines the range of the new partition, and must
differ from the existing boundary ranges of the partition function. Based on boundary_value, the Database
Engine splits one of the existing ranges into two. Of these two, the one where the new boundary_value resides
is considered the new partition.
* BCP can be used to produce the zipped text file.
* Example:
Splitting a partition of a partitioned table or index into two partitions
The following example creates a partition function to partition a table or index into four partitions. ALTER
PARTITION FUNCTION splits one of the partitions into two to create a total of five partitions.
CREATE PARTITION FUNCTION myRangePF1 (int)
AS RANGE LEFT FOR VALUES ( 1, 100, 1000 );
GO
–Split the partition between boundary_values 100 and 1000
–to create two partitions between boundary_values 100 and 500
–and between boundary_values 500 and 1000.
ALTER PARTITION FUNCTION myRangePF1 ()
SPLIT RANGE (500);
References:
http://technet.microsoft.com/en-us/library/ms186307(v=sql.110).aspx
http://technet.microsoft.com/en-us/library/ms162802(v=sql.120).aspx
Create Table (Partitioned)
Switch Partition (Uses the least amount of System Resources)
BCP
Drop Table
(Merge Range + Split Range (If the first Table should get new partitioning ranges))