It’s been a month after the new year started. Hope everyone is having a wonderful time.
This is my first post for this year and it’s a simple one but most of them are looking around for this option quite from SQL Server 2012.
Applies to
- SQL Server 2016 and Above
In earlier when we work with table paritioning and when we want to truncate a pariticular partition we have to rely on partition switching only. How ever from SQL Server 2016 we have the facility to truncate data at partition level. It’s pretty straight forward, sample command below.
USE mydb GO --Individual Partitions TRUNCATE TABLE MyTable WITH (PARTITIONS (7, 11)) GO --Range of Parititions TRUNCATE TABLE MyTable WITH (PARTITIONS (30 TO 40)); GO
Leave a Reply