A Big Oops Trying to Help Someone

Posted by Ok_Pomelo_2685@reddit | talesfromtechsupport | View on Reddit | 27 comments

A couple of jobs ago, I built a SQL query for finance that would fix sales discrepancies at the end of each month. These discrepancies were mistakes and typos done by the closing manager in our retail stores.

Finance would tell me what they were expecting based on the deposits. I was methodical about the process. I summarized all the individual transactions and dumped everything into a temp table for review before writing it to the production table.

I was comparing the production table to my temp to make sure what was already correct, was still correct, and what wrong, is now fixed. I discovered an issue, which happened, so I wanted to make a change and run the query again. Anyway, for some ungodly reason, I decided to manually type "DELETE * FROM TABLE", when I had the DELETE statement already build into my query and all I had to do was rerun it. Anyway, the table name I typed was the production table. I already had the left mouse button pressed to execute the command. The signal from my brain to my right pointer finger to release the button was already sent. I knew I screwed up as my finger was releasing the mouse button. I just deleted the entire production table.

Instant meat-sweats. I panicked for about 10 minutes until I was able to gather my thoughts. In that time, someone from finance called me letting me know that something was now really wrong with the sales data, which I already knew. I'm dreading telling my boss that we have to pull a backup. I then realized I could rebuild the summary table by using a few other tables. It took me about four hours to write a new SQL query to rebuild the table and test the output. The finance employee validated and all was good.

No one in my department ever found out. As far as the finance employee knew, there was already an issue that I was working on.