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
 General SQL Server Forums
 New to SQL Server Administration
 restore records from table in a snapshot

Author  Topic 

groadssql
Starting Member

9 Posts

Posted - 2011-02-13 : 22:19:10
I have a snap shot of a database. In one of the tables some records have been deleted and I need to restore only the deleted rows from the snap shot. I am not sure how to do that. Thanks in advance for your help.

GAR

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-02-13 : 22:41:59
Can't you just do INSERT INTO/SELECT (from snapshot)?

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

Subscribe to my blog
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-02-14 : 04:46:21
Something like this will probably do the trick:
insert into prod
select snap.*
from mydbsnapshot.dbo.tablename snap
left outer join mydb.dbo.tablename prod
on snap.id = prod.id
where prod.id is null


- Lumbago
My blog-> http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/
Go to Top of Page
   

- Advertisement -