11/11/2022 0 Comments Truncate table sql server![]() ![]() Logically, TRUNCATE TABLE is similar to a DELETE statement that deletes all rows, or. Then, the ROLLBACK command is executed and finally another “SELECT *” statement for fetching data. TRUNCATE TABLE empties a table completely. The SELECT * statement is run again to see the table data that should have been removed. There, the DELETE FROM command is used for removing the complete data. To prevent Truncate Table command to delete all data in database table SQL Server database administrator can create Foreign Key Constraint referencing table. This is followed by using the ROLLBACK script. ![]() The example of ROLLBACK using MS SQL Serverįor having an idea how data can be rolled back as using the DELETE command, see the little code below.įirst of all, we retrieve the complete data from the sto_products table.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |