Skip to Content
SQL Server 2014 Development Essentials
book

SQL Server 2014 Development Essentials

by Basit A. Masood-Al-Farooq
July 2014
Intermediate to advanced
214 pages
4h 47m
English
Packt Publishing
Content preview from SQL Server 2014 Development Essentials

The TRUNCATE TABLE statement

The TRUNCATE TABLE statement is another way to delete all rows from a table. Unlike the DELETE statement, SQL Server does not log individual row deletion in a transaction log. Therefore, this operation is not recoverable because when you run the TRUNCATE TABLE statement, SQL Server just logs page deallocations that occur as a result of this operation. The TRUNCATE TABLE statement is much faster when compared to the DELETE statement, with no WHERE clause, because it uses fewer system and database transaction log resources.

You cannot use the TRUNCATE TABLE statement on tables that are referenced by a foreign key constraint, included in an indexed view, or published for transactional or merge replication. In such a situation, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

What's New in SQL Server 2012

What's New in SQL Server 2012

Rachel Horder
Mastering SQL Server® 2008

Mastering SQL Server® 2008

Michael Lee, Gentry Bieker
Microsoft® SQL Server 2012 Unleashed

Microsoft® SQL Server 2012 Unleashed

Ray Rankins, Paul T. Bertucci, Chris Gallelli, Alex T. Silverstein

Publisher Resources

ISBN: 9781782172550Supplemental Content