Today, I delete some rows from a table accidentally, and the worst is that I didn't backup any databases including log.
Fortunately, I found a original copy in another sql server, so I added the server link to get the rows back.
IF EXISTS(SELECT * FROM sys.servers WHERE name = N'S1_instance1')
EXEC master.sys.sp_dropserver 'S1_instance1','droplogins'
GO
EXEC sp_addlinkedserver
@server=N'S1_instance1',
@srvproduct=N'',
@provider=N'SQLNCLI',
@datasrc=N'localhost\MSSQLSERVER,1433';
go
insert into S1_instance1.AdventureWorks2012.Production.ProductCostHistory
Select * from Production.ProductCostHistory
WHERE StandardCost BETWEEN 12.00 AND 14.00
AND EndDate IS NULL;
PRINT 'Number of rows selected is ' + CAST(@@ROWCOUNT as char(3));
阅读(435) | 评论(0) | 转发(0) |