Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 accidently executed delete command on the db

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-09-20 : 07:23:02
Deepak writes "SQL Team,
Accidently i have executed delete command on my db without specifying the year and it deleted all the data . query is mentioned below:

delete from game_type1 where facility_id in(select facility_id from facility_details where facility_name='Madill GC' or facility_name='Goldsby GC') and month(convert(varchar(10), data_date, 101))=9

Is there any way that i can recover the deleted data and restore it again. It will be a great help for me . It can save my job.

Thanks in advance.

Thanks,
Deepak"

OBINNA_EKE
Posting Yak Master

234 Posts

Posted - 2006-09-20 : 07:25:05
Tell you DB Admin to restore it now

If it is that easy, everybody will be doing it
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-09-20 : 07:26:18
Your only option is to restore latest backup else God help you !

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-09-20 : 09:28:07
I'm sorry that this won't help you now but...

For you and anyone else that has access to production data and needs to perform deletes and update statements directly on that production data, here are a couple tips:

1. write the DELETE or UPDATE statement but before you execute it, change the command to SELECT. Look at the selected results and confirm they are only the rows you want to change.

2. issue a BEGIN TRAN before the statement, confirm the results then issue either a COMMIT or ROLLBACK accordingly. Keep in mind that while the transaction is open you may be blocking access to those tables/rows.

3. (this should really be number 1)
Hopefully you have a development/qc environment that developers only have access to. The statements can be run there first then after successfull verification, submit the script to an Operations/DBA person who is one of the few people with access to production servers for them to run.

Be One with the Optimizer
TG
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-09-20 : 09:29:48
It's dead Jim

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-09-20 : 09:33:25
quote:
Originally posted by X002548

It's dead Jim

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam





- ^
-
Indeed!

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -