`

sql跨数据库服务器查询

    博客分类:
  • sql
阅读更多

insert into carvingcertificate select * from openrowset('SQLOLEDB','12.12.12.10';'sjjh';'jsgdzy',' select
   id,
  SNo,
  CARVINGCERTIFICATENUm,
  CarvingAreaID,
  Create_Date,
  Create_Year,
  Create_Person from newseal.dbo.carvingcertificate where sno like ''3201010%''
')

 

 

 

select * from openrowset( 'SQLOLEDB ', 'IP地址'; '用户名'; '密码',数据库名.dbo.表名)

 

//sql server 2005如果不能执行上面的语名,那么执行下面起动部分,使用完成后关闭此项功能以勉出现安全漏洞

--启用Ad Hoc Distributed Queries:
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
   -- 使用完成后,关闭Ad Hoc Distributed Queries:
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics