SQL Server Drop and Truncate

SQL Server Drop command is used to drop the table from the database.

Syntax:
drop object object_name

Example:
drop table emp

SQL Server Truncate command used to delete all records from table or it makes table empty.

Syntax:
truncate tabel tablenamee

Example:
truncate table emp

Differences between delete and truncate

DELETE TRUNCATE
Can delete all or particlular records Truncate deletes all records
Delete does not release memorr Truncate releases memory
Restoring is possible With Truncate restore is no possible
Delete will not reset identity Truncate will reset identity

Identity is used to generate serial numbers for a column in table mostly for a primary keys.

Powered by k2schools