Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

delete vs truncate sql server

DELETE:
1.Delete command is used to delete a row in a table.
2.You can rollback data after using delete statement.
3.It is a DML command.
4.It is slower than truncate statement.

-- DELETE Syntax 
DELETE FROM table_name WHERE condition;

TRUNCATE:
1.Truncate is used to delete all the rows from a table
2.You cannot rollback data.
3.It is a DDL command.
4.It is faster.

-- TRUNCATE Syntax 
TRUNCATE TABLE table_name;
 
PREVIOUS NEXT
Tagged: #delete #truncate #sql #server
ADD COMMENT
Topic
Name
3+9 =