Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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

user-image
Question ajoutée par MUHANNAD ABDULLAH ALI ABDULLAH , SENIOR INCIDENT MANAGER , JNCO
Date de publication: 2017/02/11
Utilisateur supprimé
par Utilisateur supprimé

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
par 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