ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
Can you tell me the difference between DELETE & TRUNCATE
commands?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Can you tell me the difference between DELETE & TRUNCATE commands?
Answer
# 1
Delete command removes the rows from a table based on the
condition that we provide with a WHERE clause. Truncate will
actually remove all the rows from a table and there will be
no data in the table after we run the truncate command.
 
Is This Answer Correct ?    13 Yes 2 No
Guest
 
  Re: Can you tell me the difference between DELETE & TRUNCATE commands?
Answer
# 2
 Delete Command require Log file updation for each row of 
deleting process. But the Truncate command not.
So, the Truncate Command is so faster than Delete Command. 
 
Is This Answer Correct ?    10 Yes 3 No
Kmbkrishnan
 
 
 
  Re: Can you tell me the difference between DELETE & TRUNCATE commands?
Answer
# 3
Truncate will fail if the concerned table has foreign key 
constraints while delete doesnt.
 
Is This Answer Correct ?    4 Yes 7 No
Kumar
 
  Re: Can you tell me the difference between DELETE & TRUNCATE commands?
Answer
# 4
Truncate is DDL Command while Delete is DML Command
 
Is This Answer Correct ?    9 Yes 0 No
Sachin Patil
 
  Re: Can you tell me the difference between DELETE & TRUNCATE commands?
Answer
# 5
Truncate command result can be rolled back as it is not 
made an entry in the log where as Delete command result 
can't be rolled back
 
Is This Answer Correct ?    2 Yes 16 No
Saradhi
 
  Re: Can you tell me the difference between DELETE & TRUNCATE commands?
Answer
# 6
Delete command only delete the rows from the  table but the 
schema of the table yet remains.Whereas Truncate command 
delete the rows along with the tale's schema from the 
memory permanently.
 
Is This Answer Correct ?    1 Yes 6 No
Amita
 
  Re: Can you tell me the difference between DELETE & TRUNCATE commands?
Answer
# 7
Delete command deletes the data from the tables .. but can 
get back on issue of roll back whereas when you issue 
truncate deletes the records and oracle implicitly issues 
commit command and even when you issue rollback you won't 
get the data back
 
Is This Answer Correct ?    2 Yes 1 No
Mohsin Mohammed Abdul
 
  Re: Can you tell me the difference between DELETE & TRUNCATE commands?
Answer
# 8
http://weblogs.sqlteam.com/mladenp/archive/2007/10/03/SQL-
Server-Why-is-TRUNCATE-TABLE-a-DDL-and-not.aspx
 
Is This Answer Correct ?    0 Yes 0 No
Afzal_aziz
 
  Re: Can you tell me the difference between DELETE & TRUNCATE commands?
Answer
# 9
Truncate:

 - deallocates the data pages in a table and only this 
deallocation is stored in transaction log

 - aquires only table and page locks for the whole table. 
since no row locks are used less memory is required  (lock 
is a pure memory object)

 - resets identity column if there is one

 - removes ALL pages. NO empty pages are left behind in a 
table

 - fast(er)

 - doesn't fire delete triggers

Delete:

 - removes one row at the time and every deleted row is 
stored in the transaction log

 - aquires table and/or page and row locks for the whole 
table 

 - leaves identity column alone

 - can leave empty pages in a table since empty page 
removal requires a table lock which doesn't necessarily 
happen

 - slow(er)

 - fires delete triggers 


http://weblogs.sqlteam.com/mladenp/archive/2007/10/03/SQL-
Server-Why-is-TRUNCATE-TABLE-a-DDL-and-not.aspx
 
Is This Answer Correct ?    2 Yes 2 No
Afzal_aziz
 
  Re: Can you tell me the difference between DELETE & TRUNCATE commands?
Answer
# 10
truncate provide faster processing than delete because of 
truncate does'n require transaction log uddation
 
Is This Answer Correct ?    10 Yes 0 No
Gk Singh
 
  Re: Can you tell me the difference between DELETE & TRUNCATE commands?
Answer
# 11
Delete command removes the rows from a table based on the
condition that we provide with a WHERE clause. Truncate will
actually remove all the rows from a table and there will be
no data in the table after we run the truncate command.
 
Is This Answer Correct ?    4 Yes 0 No
Vijay Dev Arya
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
How can you see what type of locks used?  1
where do you use Isolations?give me some exmpale?  1
i want to create procedure for create table in sql server 2005 for example create procedure create_table @table varchar(20) as create @table( id int, name char(20) ) but it will get error what is solution? Aptech4
what are batch in sql server? Satyam2
write down the sql query? Table Name : emp1 empid empname 1 bala 2 guna Table Name : emp2 empid empname 1 <Null> 2 <Null> Solution : emp1 names are updated in emp2, write a query?  7
Can you have a nested transaction? HCL3
what is the query and condition to delete datas in sql server.  2
what is the order of execution of where,having,group by in select stement Tanla-Solutions5
what is maximum size of temp db? iSoft4
how to rest identity columns in sql server Matrix3
how can we use a composite key for two tables and how can we represent it BoA1
How will u get 5 years back record?  4
What types of integrity are enforced by a foreign-key constraint  1
Alternative way to DetDate() function?  4
How do you find the number of rows in a table?  5
What is a job?  3
What is transcation?Plz give One example?  2
What are the different types of backup avaible in SQL SErver Emphasis5
What is the difference between DTS and SSIS? Allianz3
how to count datewise data in sqlserver IndusInd-Bank3
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com