difference between truncate delete and drop in SQL Server

difference between TRUNCATE, DELETE and DROP in SQL Server

DELETE Command

 1. DELETE is a DML command.
 2. DELETE is more slower than TRUNCATE command.
 3. DELETE maintain the logs before execute command. So its slower.
 4. In DELETE case, data rollback passable because it's maintain log file. 
 5. If we execute DELETE command that time tiger fired.
 6. In DELETE, we can use the WHERE clause.

      Example.  DELETE FROM AppLog WHERE LogId=1


TRUNCATE  Command

  1.   TRUNCATE is a DDL command.
  2.   TRUNCATE is more faster than DELETE command.
  3.   TRUNCATE not maintain logs so it's faster.
  4.   In TRUNCATE  case, data rollback not passable because it's not maintain log file .
  5.   If we execute TRUNCATE command that time tiger not fired.
  6.   In TRUNCATE , we can't use the WHERE clause.
     Example. TRUNCATE TABLE AppLog

DROP  Command

  1. DROP  is a DDL command.
  2. In case of DROP  command, TABLE delete permanently that menace all the table's  rows, indexes and privileges will  be removed from database.

  Example. DROP TABLE AppLog

ANIL SINGH

Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - http://www.code-sample.com and http://www.code-sample.xyz
My Books - Buy Books Online at Best Prices

You Might Also Like
Post a Comment
www.code-sample.com/. Powered by Blogger.