Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

In a database, whats the difference between a delete statement and a truncate statement ?

user-image
Question added by MUHANNAD ABDULLAH ALI ABDULLAH , SENIOR INCIDENT MANAGER , JNCO
Date Posted: 2017/02/11
Deleted user
by Deleted user

Both DELETE and TRUNCATE commands are used to delete records from table. But

TRUNCATE is DDL command like DROP, whereas DELETE is a DML command. Therefore DELETE operations can be rolled back (undone), while DROP andTRUNCATE operations cannot be rolled back

Shekar Kola
by Shekar Kola , Data & BI Specialist , Tec Evolution Technology Systems

Following are 2 main differences between Delete & Truncate statements1. Delete: keeps the track of identity columns, spaces used by table remains    Truncate: doesn't keep any spaces used by table, Identity begins from scratch Example: Identity column get the next record from the last generated  value even all the records DELETED, but if TRUNCATED identity starts from first available value from identity   2. Delete: maintains the records in Log    Truncate: deletes the records without maintaining log  

 

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.