Delete(It deletes all data, but not table with structure)
We can delete 1 or more or All rows from a table.
It supports " Where " clause
Slow performance
We can get back rows
It can invoke triggers
Truncate
We can delete all rows from a table. It is not possible to delete 1 or 2 rows.
It won't support " Where " clause.
High performance
We can't get back rows.
It can't invoke triggers.
Drop (It deletes complete table with structure)
Note#
Truncante is performs better than delete because when you delete the records from the database, database has to perform 2 actions.
1.delete from the database
2.write the deleted records into "rollback" segments.
But incase of "Truncate" the second activity is not required.
Summary
In this article I try to explain the diffrence between DELTE , TRUNCATE and DROP in SQL Server. I hope after reading this article you will be able to understand cursors in Sql Server. I would like to have feedback from my blog readers. Please post your feedback, question, or comments about this article.
No comments:
Post a Comment