Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Difference between Truncate and Delete
WhatsApp
Ankit Nandekar
13y
4.2
k
0
0
25
Blog
Difference between Truncate and Delete
Delete:
1)Rollback operation can be performed on delete queries
2)"where"clause can be used on delete queries
Truncate:
1)Rollback operation can not be performed on Truncate queries
2)"where" clause can not be used on Truncate queries
And most imported point about Truncate is truncate drops the table structure and recreates the table structure .
For example we may have a identity coulmn which is autoincremented (say empid),when there are 100 records in table
1)when we delete all the 100 records using "delete" query ,it deletes all the records but when we try to insert the new record the autoincremented value(empid) will be 101.
2) For the same scenario if we use truncate query to delete all 100 records.When we try to insert to insert new record the autoincremented value(empid) will be 1.
Difference between Truncate and Delete
Up Next
Difference between TRUNCATE and DELETE in SQL
Ebook Download
View all
Introducing Microsoft SQL Server 2016
Read by 11k people
Download Now!
Learn
View all
Membership not found