Home Dashboard Directory Help
Search

TRUNCATE PARTITION by xor88


Status: 

Closed
 as Won't Fix Help for as Won't Fix


6
0
Sign in
to vote
Type: Suggestion
ID: 774012
Opened: 12/11/2012 3:34:55 AM
Access Restriction: Public
0
Workaround(s)
view

Description

SQL Server should provide a statement that allows truncating a partition in a partitioned table. Currently, it is possible to truncate an entire table using TRUNCATE TABLE. There should be a command to do just that for a single partition.

Currently, one needs to create a a table with partition-aligned schema, switch out the partition and drop the table. This is tedious and error prone. TRUNCATE PARTITION should provide just that.
Details
Sign in to post a comment.
Posted by Microsoft on 2/20/2013 at 11:31 AM

Hi, thanks for your feedback. As you note, there is a way to do this today by moving the partition to a second table through ALTER TABLE SWITCH and then truncating the second table. If both tables are part of the same filegroup, this should actually be a low-risk operation as no data is moved, we just update the metadata. We will consider making this easier in a future release but we won't be able to prioritize making this change at this time.
Sign in to post a workaround.