开发者

Update statement involving two different catalogs

开发者 https://www.devze.com 2023-01-17 08:52 出处:网络
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:

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?


Try this:

update t
    set status = b.status
    from myTable t
        inner join lastBackup.dbo.myTable b
            on t.idField = b.idField
0

精彩评论

暂无评论...
验证码 换一张
取 消