79140727

Date: 2024-10-30 10:50:10
Score: 1
Natty:
Report link

As per the answers in comment section. There are 2 ways this can be achieved:

  1. Perform operations on a copy test DB.
  2. Use Transactions.

Going with the second way, suppose below are the operations we want to perform (IRL I had some complex SPs but let's consider this for now)

INSERT INTO ValueTable VALUES(1);
INSERT INTO ValueTable VALUES(2);

Then we can start a transaction and execute these changes as below

BEGIN TRANSACTION;
INSERT INTO ValueTable VALUES(1);
INSERT INTO ValueTable VALUES(2);
SELECT * FROM TABLENAME;

We can see the logs generated by these operations and decide if we want to proceed or revert by running COMMIT or ROLLBACK respectively as @siggemannen mentioned.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @siggemannen
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Jayendra Awasthi