Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Difference between Delete and Truncate

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 568
    Comment on it

    Following is difference between Delete and Truncate in database:

    Delete:

    1. DELETE is a DML(Data Manipulation Language) Command.
    2. DELETE statement is executed using a row lock, each row in the table is locked for deletion.
    3. You can add filters in where clause, hence It can delete particular data if where condition exists.
    4. Delete activates a trigger as the operation are logged individually.
    5. Slower than truncate as it keeps logs.
    6. Rollback is possible.

    TRUNCATE

    1. TRUNCATE is a DDL(Data Definition Language) command.
    2. TRUNCATE TABLE always locks the table and page but not each row.
    3. Cannot use Where Condition hence It removes all the data.
    4. TRUNCATE TABLE cannot activate a trigger because the operation does not log individual row deletions.
    5. Faster in performance wise, because it doesn't keep any logs.
    6. Rollback is possible.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: