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
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Restore a column

Author  Topic 

PingTheServer
Starting Member

28 Posts

Posted - 2009-01-02 : 12:53:15
Lets say someone makes a mistake,like leaving off the where clause when updating, and we need to restore a single column or table.

I have a full backup and a transaction log backup from an hour ago.

How would I accomplish this? Restore to a new db first? If so, what then?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-02 : 12:56:07
do you have any audit columns in your table like datemodified?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-01-02 : 13:01:10
Yes restore the full backup to a new database and then apply all transaction logs since the last full backup up to and including the change. Then use T-SQL to move the data between the two databases.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

PingTheServer
Starting Member

28 Posts

Posted - 2009-01-02 : 14:13:58
quote:
Originally posted by tkizer
Then use T-SQL to move the data between the two databases.


Do you know where I could find some examples. Google isnt coming up with much for me right now.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-01-02 : 14:15:22
Well it depends on what you want to do. Here's an example update between the two databases:

UPDATE t1
SET Column1 = t2.Column1
FROM DB1.dbo.Table1 t1
INNER JOIN DB2.dbo.Table1 t2
ON t1.PKColumn = t2.PKColumn

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

PingTheServer
Starting Member

28 Posts

Posted - 2009-01-02 : 15:14:59
that can get me practicing. Thanks Tara. You and your co-moderators really make this a good resource - if you dont hear it enough.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-01-02 : 15:19:33
Thanks for the compliment! And you're welcome.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -