The SQL statement Truncate Table

Recommended for you: Get network issues from WhatsUp Gold. Not end users.
      The SQL statement after recording a job only contact, is Truncate Table, Truncate is a rapid emptying tables all data in SQL. And be aimed at the automatic increment value field, do count reset zero recalculate role.
      Grammar: TRUNCATE TABLE name
      Note: TRUNCATE TABLE in the same function with the DELETE statement with no WHERE clause: the two are all rows in the table. But TRUNCATE TABLE is faster than DELETE, and the use of fewer system and transaction log resources.
The DELETE statement every time a row is deleted, and the deleted record per line a as in the transaction log. Data page of TRUNCATE TABLE through the release of stored data used to delete data, and records the page in a transaction log release.
TRUNCATE TABLE removes all the rows in the table, the table structure and columns, constraints, indexes remain unchanged. The new logo for the column count reset seeds. If you want to preserve the identity of the count, please use DELETE. If you want to delete the table definition and data, use the DROP TABLE statement.
For constrained by FOREIGN KEY referenced tables, you cannot use TRUNCATE TABLE, but should use the DELETE statement with no WHERE clause. Because TRUNCATE TABLE is not recorded in the log, so it cannot activate the trigger.
TRUNCATE TABLE cannot be used in an indexed view.
Delete the TRUNCATE TABLE data sheet, to use the UPDATE STATISTICS to maintain the index information.
If a ROLLBACK statement, DELETE operation will be revoked, but TRUNCATE does not revoke.
       For fast deleting test, garbage data development, very good use.
       Sharing benefit more peopleļ¼
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Nan at December 04, 2013 - 10:04 AM