| ID | Name | Age | Department | |
| 1 | Ashish | 25 | DotNet | |
| 2 | Mohit | 26 |
| |
| 3 | Amit | 24 |
|
we have a table name - Employee & ID is auto genrate. suppose i want to delete the record with this query.
Delete from Employee Where ID=2
but after delete the record i want to again rollback how is it posible . plz explain me with easy way (i want to rollback )
and what is the diff b/w rollback & Commit

ashleyturnierPosted Oct 11, 2013, 1:41 AM
Rasadul Alam RashedPosted May 16, 2013, 4:19 AM
You can use this: http://cybarlab.com/transactions-in-sql-server
Shankar MPosted May 7, 2013, 1:01 AM
You can use Explicit Transaction to do such changes..
Explicit Transactions are nothing but where you explicitly call the start and end of the Transaction..
To Start a Transaction we specify,
BEGIN TRANSACTION
In case of Error, we specify
ROLLBACK TRANSACTION.
To End a Transaction successfully we issue,
COMMIT TRANSACTION
While using Explicit Transactions, the transaction is done as a whole or none of the Transaction is committed.
Gaurav GuptaPosted Apr 12, 2013, 6:13 AM
http://raresql.com/2011/10/22/how-to-recover-deleted-data-from-sql-sever/
Ashish SaxenaPosted Apr 12, 2013, 3:51 AM
Gaurav GuptaPosted Apr 12, 2013, 3:37 AM
For Example you can write the query like this....
begin tran
Delete from Employee Where ID=2
Rollback tran
You can also read the following Blog on C-SharpCorner
http://www.c-sharpcorner.com/Blogs/5318/