Win Surprise Gifts!!!
Top 5 Contributors of the Month
Post New Question
Subscribe to Forum
July 19, 2009
what is the difference between truncate and delete commands and explain some of them
Posted Date: July 19, 2009 Points: 5
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.
Syed Shakeer Hussain
Posted Date: July 20, 2009 Points: 5
When you use Truncate
1) Removes all Rows from a Table
2) Releses the storage space used by that table
3) You cannot roll back row removal when using TRUNCATE.
4) If the table is Parent of a refrential integrity constraint,you cannot truncate the TABLE.Disable the constraint before issuing the TRUNCATE statement.
5)Truncate removes all rows faster than Delete Statement.
TRUNCATE TABLE tablename;
tablename is the name of the table.
1)Delete command only removes records,it remains table structure.
2)you can use where statement usind delete command.
Posted Date: July 22, 2009 Points: 5
Faizal told correctly more ever...just see the following.so u got clear idea about usage also
If you want to quickly remove all rows of data in a table, use [TRUNCATE] command. Sample SQL statement using [TRUNCATE] command :
TRUNCATE TABLE [tablename]
All indexes, triggers, and structures still remain intact. It is faster than [DELETE] command because when using [DELETE] command, the data is removed and logs as transaction one row at a time. On the other hand, [TRUNCATE] will deallocate the entire data page in the table and reduces the number of logs activities; thus performs better compare to [DELETE] command.
Sample using [DELETE] command:
1. DELETE FROM [table name]
2. DELETE FROM [table name] WHERE [clauses]
To post reply
Related Questions Related Questions
whats the difference between Drop Truncate and Delete in Sql
Auto Increment id not getting decremented with Delete Record
ASP.NET - Datagrid with Display, Edit, Delete and Sort functionalities
ASP.NET Grid with Add, Delete, Edit and Rows REORDER Functionalities
How to Delete Non-Empty Folder in Vb.net
banding navigator + delete button+ items position
how to delete Extra row in wpf datagridview...
delete specific file from folder in vb dot net
c# code for datagrid with delete button
Latest Forum Questions From The Same Category
Sql Bulk Insert from multiple delimited Textfile using c#.net
Read *.ds file to Dataset Object
TNS:address already in use Exception
Accessing Virtual folder
Dynamically Insert single record into MS access from SQL server
Deleting records from database while deselecting checkbox in gridview
How to generate script to export Database programmatically
Abstact and Interface Class
How to ingnore by default value of comboboxes?
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more
Quick Links For Forum Categories:
Hall of Fame
Terms of Service
Tell A Friend