Home
> SQL Server 2016 > Now truncate “Table Partitions” with TRUNCATE TABLE statement – SQL Server 2016
Now truncate “Table Partitions” with TRUNCATE TABLE statement – SQL Server 2016
TRUNCATE TABLE has got a new definition now!!!
Now with SQL Server 2016 as per MSDN BoL: “TRUNCATE TABLE removes all rows from a Table or Specified Partitions of a Table, without logging the individual row deletions”.
This is kind of a filtration to TRUNCATE TABLE statement at a Partition level, just like a WHERE clause option with DELETE TABLE statement at a Row level.
With previous versions ( SQL Server 2014 and back) you could only Truncate a whole Table, but not its Partition.
–> You can now use a WITH PARTITIONS() option with TRUNCATE TABLE statement to truncate Table Partition(s) like:
TRUNCATE TABLE dbo.PartitionedTable WITH (PARTITIONS (2, 4, 6 TO 8))
MSDN reference for [TRUNCATE TABLE]
Check my [previous post] on differences between TRUNCATE & DELETE statements.
Categories: SQL Server 2016
SQL Server 2016, TRUNCATE, TRUNCATE PARTITIONS
MSDN link would be very helpful, you have done it before.
oh, I didn’t?
here you go… thanks for your comments.
great work
Love this new feature! Thanks for pointing it out!