1. 程式人生 > >SQL-Server-只還原某個欄位

SQL-Server-只還原某個欄位

今天工作沒有在狀態,對project表執行update時沒有寫where語句。

update project set extselectitemfield13 = '8a2135646627e8a90166566485045ff8'

還好昨天有做備份,美滋滋。但是問題來了,能不能只還原extselectitemfield13這一個欄位呢,因為還做過其他修改,如果整張表全部還原那麼今天做的工作就全白費了。以前就遇到這個問題,但是沒有是實現,這次又不死心試了試,終於寫了出來。廢話不多說,上乾貨。

update project set extselectitemfield13=
(select  extselectitemfield13 from  [test1].[dbo].[project] a where a.id= project.id)

首先,把昨天備份的還原到test1,然後執行如上SQL即可。