你也可以執行一個INSERT/SELECT操作,在基于恢復數據庫的一個查詢的生產數據庫上插入紀錄。因為我們的Order Details表沒有IDENTITY欄,所以可以通過在一張臨時表中插入紀錄和使用ROW_NUMBER()函數來自己創建這一欄。
--This inserts records in a temporary table and assigns a dummy identity value for reference
SELECT ROW_NUMBER() OVER (ORDER BY OrderID) AS ROWID, *
INTO Northwind_recover.dbo.OrderDetailsRecover
FROM [Order Details]
--This inserts recovered records from the recovered database into the production database based on
--the dummy identity valuewe have assigned for reference
INSERT INTO Northwind.dbo.[Order Details] (OrderID,ProductId,UnitPrice,Quantity,Discount)
SELECT OrderID,ProductId,UnitPrice,Quantity,Discount
FROM Northwind_recover.dbo.OrderDetailsRecover
WHERE ROWID>
(
SELECT COUNT(*)
FROM Northwind_RestorePointSnapShot.dbo.[Order Details]
)
請注意,我們使用數據庫快照來識別我們所設法還原的和我們所恢復的區別。
延伸閱讀
文章來源于領測軟件測試網 http://www.kjueaiud.com/