Chinaunix首页 | 论坛 | 博客
  • 博客访问: 130334
  • 博文数量: 69
  • 博客积分: 595
  • 博客等级: 中士
  • 技术积分: 670
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-16 17:37
文章分类

全部博文(69)

文章存档

2017年(2)

2016年(9)

2015年(13)

2014年(30)

2012年(4)

2011年(2)

2010年(2)

2009年(5)

2008年(2)

我的朋友

分类: SQLServer

2014-12-13 15:08:18

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) |
给主人留下些什么吧!~~