I have problem in sql query

Posted by Nuwan under Sql Server on 7/9/2012 | Points: 10 | Views : 1082 | Status : [Member] | Replies : 10
Hi all,

Unfortunately I use wrong delete command without where condition my one of table all the data deleted,
How I recover it? Is it possible. Please help me.

Thanks...

Rathnayake


Responses

Posted by: Akiii on: 7/9/2012 [Member] Bronze | Points: 25

Up
0
Down
You don't have a backup of the database ?


Thanks and Regards
Akiii

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nuwan on: 7/9/2012 [Member] Starter | Points: 25

Up
0
Down
Actually I have old backup... It not included new data.

Rathnayake

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 7/9/2012 [Member] Bronze | Points: 25

Up
0
Down
I don't think that it is possible. Whenever running a delete or update you should always use BEGIN TRANSACTION, then COMMIT if successful or ROLLBACK if not. Have you done that ?


Akiii

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Johnbhatt on: 7/9/2012 [Member] Starter | Points: 25

Up
0
Down
This is nearly Impossible.

But While searching for Solutions I found a Link,

http://raresql.com/2011/10/22/how-to-recover-deleted-data-from-sql-sever/

Try to Get if some helpful there.

John Bhatt
Glad to Know, Free to Share.....
http://www.johnbhatt.com

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nuwan on: 7/9/2012 [Member] Starter | Points: 25

Up
0
Down
Actually I only do "delete from table1" run that query



Rathnayake

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhupentiwari on: 7/9/2012 [Member] Starter | Points: 25

Up
0
Down
I think it not possible.

Thanks n Regards
Bhupendra Tiwari

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 7/9/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
its not possible.


Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 7/9/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

I also think that it is impossible

but as John Bhatt post a link i read review and many people say that its working fine for some table for sql server 2005 and above

Really that's nice

Regards


R D Patel

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 9/4/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi,
I also think that it is not possible.
When you delete datas from database, please use TRANSACTION.

DECLARE @CustomerID AS int
SET @CustomerID=''

BEGIN TRY
BEGIN TRANSACTION;

IF EXISTS(SELECT * FROM Customer WHERE CustomerID=@CustomerID)
BEGIN
DELETE FROM Customer WHERE CustomerID=@CustomerID
PRINT 'DELETED'
END

COMMIT TRANSACTION;
END TRY
BEGIN CATCH
PRINT 'Unexpected error occurred!'
ROLLBACK TRANSACTION;

END CATCH



Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Maheshvishnu on: 9/4/2012 [Member] Starter | Points: 25

Up
0
Down
Not Possible

mahesh

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response