Showing posts with label updated. Show all posts
Showing posts with label updated. Show all posts

Monday, March 19, 2012

How to revert the commited query in MS Sql Server?

Accedentally i have updated the specific field by update query of the table and to preserve the previous data .....so please help me in this regard

How to revert the commited query in MS Sql Server?

ThanX in advance!!!!!!!!

If you've commited the transaction then your only real option is to restore your database from backup. Depending on the recovery model of the database and your backup strategy it may be possible to recover to the point just before you made the update. However, changes after this point will be lost.

Of course, if the data is fairly static, its possible you could restore your database as a new database and then manually correct the action by updating the data from the restore database.

Check out overview of Restore and Backup recovery in Books Online.

HTH!

|||

Thanx. Richbrownesq

i tried with point in time recovery with the RESTORE command but it show the following error..

Msg 4338, Level 16, State 1, Line 2

The STOPAT clause specifies a point too early to allow this backup set to be restored. Choose a different stop point or use RESTORE DATABASE WITH RECOVERY to recover at the current point.

Msg 3013, Level 16, State 1, Line 2

RESTORE DATABASE is terminating abnormally.

pleas help me in this regard.

|||

The error looks like its saying that your STOPAT time is incorrect. Make sure that you are applying your transaction logs in the correct order and that the date/time specified is accurate.

If you're still having issues, please post an example of the syntax you are using to restore your database and logs.

How to revert the commited query in MS Sql Server?

Accedentally i have updated the specific field by update query of the table and to preserve the previous data .....so please help me in this regard

How to revert the commited query in MS Sql Server?

ThanX in advance!!!!!!!!

If you've commited the transaction then your only real option is to restore your database from backup. Depending on the recovery model of the database and your backup strategy it may be possible to recover to the point just before you made the update. However, changes after this point will be lost.

Of course, if the data is fairly static, its possible you could restore your database as a new database and then manually correct the action by updating the data from the restore database.

Check out overview of Restore and Backup recovery in Books Online.

HTH!

|||

Thanx. Richbrownesq

i tried with point in time recovery with the RESTORE command but it show the following error..

Msg 4338, Level 16, State 1, Line 2

The STOPAT clause specifies a point too early to allow this backup set to be restored. Choose a different stop point or use RESTORE DATABASE WITH RECOVERY to recover at the current point.

Msg 3013, Level 16, State 1, Line 2

RESTORE DATABASE is terminating abnormally.

pleas help me in this regard.

|||

The error looks like its saying that your STOPAT time is incorrect. Make sure that you are applying your transaction logs in the correct order and that the date/time specified is accurate.

If you're still having issues, please post an example of the syntax you are using to restore your database and logs.

Wednesday, March 7, 2012

How to retrieve last updated record

I have some set of records in my table.

The same set of records will be updated often. Now I have a column as "lastupdated"

While i am displaying the records in a datagrid, The LAST UPDATED record should only be displayed.

Means, the recently updated records should be displayed in datagrid.

Pls give me the sql code / i am also in need of a Stored procedure for this.

I am working in SQL 2005

SELECT TOP (1) * FROM yourTable ORDER BY lastupdated DESC

You can wrap it into a Stored Procedure:

CREATE PROCEDURE yourSP

AS

SELECT TOP (1) * FROM yourTable ORDER BY lastupdated DESC

|||

Thankyou Thankyou Thankyou,

Thanks a lot for your reply.Cool