'Undo insert query in SQL Server

I ran an insert query on a table in SQL Server by mistake and 100 rows got inserted. I want to undo it but I do not have rollback.



Solution 1:[1]

You can only delete, but for future you would need to surround your query in transaction or set such behavior manually.

By default SSMS does auto-commit. To alter this behavior use this:

SET IMPLICIT_TRANSACTIONS OFF

more here:

https://docs.microsoft.com/en-us/sql/t-sql/statements/set-implicit-transactions-transact-sql?view=sql-server-ver15

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sp4