Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
UPDATE <table name>
SET machine_incharge='Expense Approver1', active_machine='yes'


unfortunately executed with out where condition it is effected nearly 800 rows please help me to roll back the query.

Thanks in Advance

Regards
vamsi krishna j
Posted
Comments
Prasad CM 21-Apr-12 8:16am    
Do have a practice of taking daily backup?..
Otherwise without using transaction its difficult to rollback
updated data...

Rollbach does not work with DML statement.
It must have a "begin tran" or "begin transaction"
Try this:
SQL
begin tran test
Update salesproposal set statuscode = 4 where so_id = 47888
UPDATE <table name="">
SET machine_incharge='Expense Approver1', active_machine='yes'
end tran;

</table>

now you can
either
SQL
rollback tran test

or
SQL
Commit tran test
 
Share this answer
 
v2
Comments
Prasad CM 21-Apr-12 8:20am    
no..i think he is already updated without using transaction
and he is asking for any other way to rollback...
uspatel 21-Apr-12 8:21am    
See this
The rollback should have a "begin tran" or "begin transaction"
jvamsikrishna 21-Apr-12 12:30pm    
sir,
thanks for your valuable reply on my query.
i just executed a update query by mistakely.
i need to rollback all modifications.
jvamsikrishna 21-Apr-12 12:28pm    
yes prasad i had updates the table without where condition that's my mistake.

is no way to rollback?

at least i need to resolve before Monday 10am otherwise i need to pay alot
uspatel 22-Apr-12 4:21am    
If you have any latest back up then restore it.
or
find some third party database recovery tool.
and see this if it help
http://sqlserver2000.databases.aspfaq.com/how-do-i-recover-data-from-sql-server-s-log-files.html
If it was not done in a Transaction, then you cannot roll it back.

In order to use a rollback on any query, you have to start with BeginTransaction[^] method.

The link above has an example of both a Commit and Rollback for a given transaction.
 
Share this answer
 
Comments
Prasad CM 21-Apr-12 8:30am    
You r ryt sandeep..
jvamsikrishna 21-Apr-12 12:31pm    
Is any other way if u know please inform me.
thanks for your valuable info.

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