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                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
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
What's the difference between DELETE TABLE and TRUNCATE 
TABLE commands?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What's the difference between DELETE TABLE and TRUNCATE TABLE commands?
Answer
# 1
TRUNCATE is a DDL command whereas DELETE is a DML command. 
Hence DELETE operation can be rolled back, but TRUNCATE 
operation cannot be rolled back. WHERE clause can be used 
with DELETE and not with TRUNCATE.
 
Is This Answer Correct ?    14 Yes 1 No
Radh
 
  Re: What's the difference between DELETE TABLE and TRUNCATE TABLE commands?
Answer
# 2
delete table gives the transactional log where as in 
truncate it is not delete the total rows inthe table but 
structure of the table has never changed after the 
statement is executed it is roll back and the constraints 
after the delete statement is remain same where as it is 
not in the truncate statement
 
Is This Answer Correct ?    4 Yes 2 No
Srisenthil
 
 
 
  Re: What's the difference between DELETE TABLE and TRUNCATE TABLE commands?
Answer
# 3
"Delete TableName" is a logged transaction.  Every row 
affected by the delete will be written to the transaction 
log.  This is done for RECOVERY purposes, so that the 
transaction may be rolled forward from a previous database 
dump.

"Truncate TableName" is non-logged.  It removes all rows 
from the table and releases all allocated segments in the 
database, all without logging anything.  This is not 
something a developer does, but rather is done by a DBA as 
part of some sort of housekeeping.
 
Is This Answer Correct ?    3 Yes 0 No
Skybeaver
 
  Re: What's the difference between DELETE TABLE and TRUNCATE TABLE commands?
Answer
# 4
1.truncate is DDL cmd.where as delete is a DML cmd.
2.truncate  is similar to delete command without no 
condition.
3.when u use truncate it restructure the table,wthout 
bothering of data it deletes entire records.
      but,delete is a logged transaction.before delete 
records it copies to transaction log.then removes.
4.truncate take less time than delete in execution.
 
Is This Answer Correct ?    2 Yes 0 No
Nageswarao
 
  Re: What's the difference between DELETE TABLE and TRUNCATE TABLE commands?
Answer
# 5
Truncate is DDL command, Delete is a DML command.
Delete operation can be rolled back and in truncate we 
can't.
Where caluse can be used in Delete and not in Truncate.
Truncate table less time than delete in execution
 
Is This Answer Correct ?    3 Yes 0 No
Sreedhar
 
  Re: What's the difference between DELETE TABLE and TRUNCATE TABLE commands?
Answer
# 6
Truncate / When use Truncate after that insert new record 
into the table row started from 1 but
 Delete / When delete record in a table after that insert 
new record row id started from after the deleted row
For e g, I m create a table Employee and insert 5 record 
row number set identity true and increment by 1 
After that, I m delete last record I e row number is 5 
after delete I m insert new record in a table then row id 
started from 6 not 5 but when truncate table row id start 
from 1
 
Is This Answer Correct ?    2 Yes 0 No
Ranjay
 
  Re: What's the difference between DELETE TABLE and TRUNCATE TABLE commands?
Answer
# 7
1.Both Truncate and Delete are rollbacked in TSQL.
2.Truncate maintains single record in Transaction log   
entire records where Delete writes one-to-one record which 
is slow in performance.
3.Truncate reinitializes the IDENTITY count to zero.
4.Truncate gives error with Table Variables.
 
Is This Answer Correct ?    3 Yes 0 No
Satya
 
  Re: What's the difference between DELETE TABLE and TRUNCATE TABLE commands?
Answer
# 8
DELETE Command
•It will delete record by record             

•Execution is slow                               
•It is a logged command, so data
 can be Restore after delete
•Condition can be applied with delete.
•It will fire trigger.                                    

TRUNCATE Command
•It will delete all the records at the Same time.
•Execution is fast.
•It is not a logged command, so data can’t
 be Restore after Truncate.
•Condition can’t be applied.
•It will not fire the trigger.

ajay.thomala@gmail.com
 
Is This Answer Correct ?    2 Yes 0 No
Ajay
 
  Re: What's the difference between DELETE TABLE and TRUNCATE TABLE commands?
Answer
# 9
TRUNCATE is a DDL command whereas DELETE is a DML command. 
Hence DELETE operation can be rolled back, but TRUNCATE 
operation cannot be rolled back. WHERE clause can be used 
with DELETE and not with TRUNCATE.
 
Is This Answer Correct ?    0 Yes 0 No
Baijnath Tiwari
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
What is the appropriate number of test cases that you can write on a database? Microsoft1
What are the two types of concurrency?  2
How to find the date and time of last updated table?  3
what operator performs pattern matching?  1
what is the main difference between after trigger and instead trigger.  1
How To Make password Protected SQL Server 2005 Database i.e when i open SQL Server database then ask for password.  1
There is table like Events...in that name ,startdate ,enddate,location are the column names write a stored Procedure for this table to get events by Months "GetEventsByMonths"  1
What are the authentication modes in SQL Server?  2
What is the difference between constraints and triggers? Wipro6
Table student containing 2 columns,Join date,Employee name. Under join date 4 rows r ter =1-jan-2008,2-feb-2008,3-mar- 2008,4-feb-2008.Under Employee name 4 difeerent names jaison,robin,binoy,rahul Result set is, Table containing 4-column name=jan,feb,mar,april,,beneath these months count is given as 1,2,1,0 means these counts representing number of emplooyees joined in a month(january 1employee,february 2 employee,march 1 employee,april 0 employee) Can you give me the required sql query Wipro3
what is the output for this query select * from employee where 1=1;  4
How can count the string ? for ex: If i have string like 'bhaskar' then i need like b:1 h:1 a:2 s:1 k:1 r:1 please give any idea on that TCS5
can we call functions from stored procedure in SQL Server 2005 ? How?  2
9. Write a query to list a new column with the difference in temp of the cities Delhi and Mumbai, Mumbai and Jammu and soon. Consider the following table : City_id City Temp. 1 delhi 40 2 Mumbai 35 3 Jammu 32 4 Pune 18  2
What are the new features in SQL Server 2005? Emphasis2
i have 4 tables.. T1, T2, T3, T4.. these tables have the same structure and they store the information entered in different years.. T1 stored 2002, T2 stored 2003, T3 stored 2004 and T4 stored 2005.. i want to copy contents in T1 to T2, T2 to T3, T3 to T4 and T4 to T1.. how do i do that? Temp tables cannot be used..  2
What command do we use to rename a db?  3
How do I list the available tables in a database I'm querying?  3
can anybody tell us, how to select 2nd max salary from table. my id is ashish.akk@gmail.com Symphony21
What are the types of indexes available with SQL Server?  2
 
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