Blog
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    API(s)
    Sencha-Touch
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog
Report Abuse Form
Reason:    
 

Home >> Database >> Difference between TRUNCATE & DELETE statement in SQL Server
Difference between TRUNCATE & DELETE statement in SQL Server

I this blog i am explaining about TRUNCATE & DELETE statement in SQL Server.
Views: 1164     Comments: 0
by Rohit Kesharwani on 6/13/2012

Difference between TRUNCATE & DELETE statement in SQL Server

Truncate and Delete both is used to delete data from the table. Both these commands will only delete the data of the specified table; they cannot remove the whole table: data along with structure.

1)      TRUNCATE is a DDL (data definition language) command whereas DELETE is a DML (data manipulation language) command.

2)      You can use WHERE clause (conditions) with DELETE but you can't use WHERE clause with TRUNCATE.

3)      You can’t rollback data in TRUNCATE but in DELETE you can rollback data. TRUNCATE removes (delete) the record permanently.

4)      A trigger doesn’t get fired in case of TRUNCATE whereas Triggers get fired in DELETE command.

5)      If tables which are referenced by one or more FOREIGN KEY constraints then TRUNCATE will not work.

6)      TRUNCATE resets the Identity counter if there is any identity column present in the table where delete not resets the identity counter.

7)      Delete and Truncate both are logged operation. But DELETE is a logged operation on a per row basis and TRUNCATE logs the deallocation of the data pages in which the data exists.

8)      TRUNCATE is faster than DELETE.

Title :  
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
       
 
Report Abuse Form
Reason:    
 
Latest ArticleRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest Blogs by Rohit KesharwaniRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 2730
  
Copyright © 2009 - 2013MindStick. All Rights Reserved.