Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Tht data in my database was updated unintentionally...i want to rollback ma previous data from database...Is there any way to recover my previous data..Plz any1 help me ..
Posted

If there is no transaction logs maintained then it cannot be rolled-back.

If you have logs, see: Rollback data with transaction log[^]

Further, in case if you had backup then just restore it from there.
Another similar discussion with possible answers, read: Similar discussion[^]
 
Share this answer
 
v3
Comments
Mathews Davis 6-May-11 6:17am    
I dont hv backup als
Dylan Morley 6-May-11 6:41am    
If you don't have any backups and you don't have any TLOG files for 'point-in-time' recovery, then you are up a certain creek and you don't have a paddle

e.g - http://msdn.microsoft.com/en-us/library/ms190982.aspx

Always backup. *Always*. Even if it's only once a day rather than full logged, at least then you've got yesterdays data you can compare and recover against.
Sandeep Mewara 6-May-11 10:03am    
Then you have no choice.
This is only possible if your database was in full recovery mode. You didnt specified your version of SQL server. If you are on 2000 than you can use this free tool[^] from Red Gate, otherwise use this tool[^] from ApexSQL. Also check out the following articles:

How can I rollback an UPDATE query in SQL server 2005?[^]
Read the log file (*.LDF) in sql server 2008[^]
 
Share this answer
 
Comments
CHill60 7-Jul-13 7:14am    
The question is 2 years old so I hope he's not still trying to recover his data :-) The link doesn't really add much to the arguments
try to find out in this way

BEGIN TRY --Start the Try Block..
    BEGIN TRANSACTION -- Start the transaction..

        UPDATE MyCurrentAccount SET Amount = Amount - 1000
            WHERE AccountId = 004
 
        UPDATE MySavings SET Amount = Amount + 'sssdgsggs'
            WHERE AccountId = 004
 
    COMMIT TRAN -- Transaction Success!
END TRY
BEGIN CATCH
    IF @@TRANCOUNT > 0
        ROLLBACK TRAN --RollBack in case of Error
END CATCH


Create table   MyCurrentAccount(AccountId  int,Amount int) 
Create table  MySavings (AccountId  int,Amount int) 

select * from MyCurrentAccount

select * from MySavings

insert into MySavings values(004,50000)
 
Share this answer
 
Comments
Mathews Davis 6-May-11 6:22am    
my prob is not to rollback in future transactions... i hv executed a query unintentionaly and my database gt updated...i hv to rollbac my previous database
Mahendra.p25 6-May-11 6:32am    
try this link

http://www.dotnetspider.com/forum/267884-how-recover-updated-data-sql-server.aspx hope it will be helful
Mahendra.p25 6-May-11 6:36am    
http://sqlserver2000.databases.aspfaq.com/how-do-i-recover-data-from-sql-server-s-log-files.html
Mathews Davis 6-May-11 7:04am    
i think de link is worth!!!!!!!!!!
You will find your answer here - http://serverfault.com/questions/305773/can-i-rollback-last-update-on-sql-database[^]
Next time provide more data. What version of SQL Server at least?
 
Share this answer
 
Comments
CHill60 7-Jul-13 7:14am    
The question is 2 years old so I hope he's not still trying to recover his data :-) The link doesn't really add much to the argument

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900