Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
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
Functions in SQL Server: Practical Guide
Read by 9k people
Download Now!
Learn
View all
Membership not found