Blog

15-Sep-2009
SQL SERVER: Difference between DELETE and TRUNCATE commands

We interviewed many people my company as recruitments are going on for developers. When I asked this SQL SERVER question to person "What is difference between DELETE and TRUNCATE in SQL SERVER?".  I got the following  answers from most of them are, which are incorrect: 1. I can not use WHERE condition with TRUNCATE command 2. I can not use TRUNCATE command if foreign key is there on table. 3. TRUNCATE is faster than the DELETE, as  DELETE write records them in Log file in case it is needed to rollback in future from LOG files. etc.. These answers are correct. I also got this answer, which is Incorrect: