If transaction did not happen then it is very hard to rollback. Take a look at this example to do this. stackoverflow.com/questions/16945254/how-to-perform-sql-roll-back-from-transaction-logs
The concept of transaction is that either all queries in a transaction will be committed or all queries in a transaction will be rolled back, you can't rollback specific query and commit others in a single transaction. you would need to create separate transaction for each query if you want to rollback a single query.
is the transaction stage saved so that we can roleback later? What I mean, lets suppose run the wrong script on production and after couplr of hours or days, can we roleback particular transaction from transaction name or stage or any reference of that transaction?
In SQL Server, transactions are typically not saved in a way that allows you to rollback a particular transaction days or hours later after it has been committed. Once a transaction is committed, it is permanent, and SQL Server does not maintain a "save point" that allows for rolling back the transaction at a later time.
@@bhanukalia356Check this URL www.linkedin.com/pulse/steps-recover-deleted-data-from-sql-table-using-transaction-/ You can do google and you will find tons of tutorials on internet on this topic.
hello sir , could you please tell which mic you are using and how did you make such clear audio for video . this will be very helpful to me , thank you so much .
You are the first person who is saying that the audio quality of the video is good. I am using the very basic Boya mic which is of around 750 rupees. I bought it from Amazon. Boya ByM1 Auxiliary Omnidirectional Lavalier Condenser Microphone with 20ft Audio Cable (Black)
Update statements scare the shit out of me. Do a select first lol. Colleague almost fucked the production database at work by missing the where clause. 😂 Didn't start a transaction either.
First execute begin tran then do whatever update or delete you want to do. now, run rollback tran All the changes will be rollbacked. Let me know if it still does not works.
@@learnssis thnaks for the response..ya it did worked..but i cant figure out then whats the real purpose of this rollback..we dont write a query knowing that we are going to make a mistake right...so what if we missed to apply a 'begin trans' and performed a query and wanted to undo
really helpful brother ahmed, jazakallah khair... kindly share these types of tips in the future also as it will help new dba's in many ways.
Sure sure, will do. Thanks.
Thank you so much. Highly appreciated.
No problem. You are most welcome Sir.
thank you and very helpful
but if i didn't start the transaction
how can i rollback ?
If transaction did not happen then it is very hard to rollback. Take a look at this example to do this.
stackoverflow.com/questions/16945254/how-to-perform-sql-roll-back-from-transaction-logs
How do I rollback a single query among 10 queries inside a single transaction
The concept of transaction is that either all queries in a transaction will be committed or all queries in a transaction will be rolled back, you can't rollback specific query and commit others in a single transaction. you would need to create separate transaction for each query if you want to rollback a single query.
is the transaction stage saved so that we can roleback later? What I mean, lets suppose run the wrong script on production and after couplr of hours or days, can we roleback particular transaction from transaction name or stage or any reference of that transaction?
In SQL Server, transactions are typically not saved in a way that allows you to rollback a particular transaction days or hours later after it has been committed. Once a transaction is committed, it is permanent, and SQL Server does not maintain a "save point" that allows for rolling back the transaction at a later time.
Sir in case we did not back up in that case how to undo
I have never tried it but can you check below link and see if this helps you
www.sqlshack.com/recovering-data-from-the-sql-server-transaction-log/
what if we delete rows without using begin tran , then can we recover records?
I think from transaction log we can recover it but I never tried that.
@@learnssis ok let me also check , where i can find transactions log?
@@bhanukalia356Check this URL
www.linkedin.com/pulse/steps-recover-deleted-data-from-sql-table-using-transaction-/
You can do google and you will find tons of tutorials on internet on this topic.
thank you man !! you helped me a lot :D
You are most welcome Sir.
Really informative👏🏻
Glad you liked the video.
Good job! Very helpful!
You are most welcome.
hello sir , could you please tell which mic you are using and how did you make such clear audio for video . this will be very helpful to me , thank you so much .
You are the first person who is saying that the audio quality of the video is good. I am using the very basic Boya mic which is of around 750 rupees. I bought it from Amazon.
Boya ByM1 Auxiliary Omnidirectional Lavalier Condenser Microphone with 20ft Audio Cable (Black)
What if we drop a table?
If you started a transaction and then if you dropped the table, but later you did rollback, then the deleted table will be restored.
Same email not save SQL query ?
Sorry did not get you ?
VERY INFORMATIVE
Thank you.
You are so good explaining
Thank you so much catusae.
thank . this really help me
Glad to know that it helped you.
Thank you so much for this video
You are so welcome!
Thank you so much 😍
You are welcome Mahasona.
NEAT!
Thank you Mehmet.
Nice bro can you do it in english next time pls
I think this is in English right ?
Thank you
You are most welcome.
Did not work
It will work if you started a transaction before deleting the data.
Update statements scare the shit out of me. Do a select first lol. Colleague almost fucked the production database at work by missing the where clause. 😂 Didn't start a transaction either.
Yeah it is a pain to loose the data when we miss to put the where clause.
helpful
Thank you Sir.
for me didnt worked
First execute
begin tran
then do whatever update or delete you want to do.
now, run
rollback tran
All the changes will be rollbacked. Let me know if it still does not works.
@@learnssis thnaks for the response..ya it did worked..but i cant figure out then whats the real purpose of this rollback..we dont write a query knowing that we are going to make a mistake right...so what if we missed to apply a 'begin trans' and performed a query and wanted to undo
@@learnssis not working tran command in sqlworkbench any other options..
@@engineersadda5550 This is for SQL Server not for MySQL.
Qqlllllqllllll@@learnssis