views:

22

answers:

1

Trying to execute an update of a single field where the current db wants to pull values from last night's backup. Should be something close to:

update myTable 
   set status = (select status 
                   from .lastBackup.dbo.myTable as t 
                  where t.idField = idField)

Help?

+5  A: 

Try this:

update t
    set status = b.status
    from myTable t
        inner join lastBackup.dbo.myTable b
            on t.idField = b.idField
Joe Stefanelli
+1: Beat me by 43 seconds...
OMG Ponies
@OMG - I love the precision of that response...
JNK
owe ya beer or better.
justSteve
@OMG: I think that's a first. Do I earn a badge for that? :-)
Joe Stefanelli
@justSteve: I'll take an "accepted answer" in place of that beer for now. :-)
Joe Stefanelli
There's a badge--but you have to get 10 upvotes first :p
OMG Ponies