sqlserver 多表查詢不同數據庫服務器上的表建站知
導讀:1建站知識sqlserver中多表查詢不同數據庫服務器上的表的實現方法,需要的朋友可以參考下百度seo網站優化seo網站優化。
第一種方法:
復制代碼 代碼如下:
/* 創建鏈接服務器 */ exec sp_addlinkedserver 'srv_lnk','','sqloledb','條碼數據庫IP地址' exec sp_addlinkedsrvlogin 'srv_lnk','false',null,'用戶名','密碼' go /* 查詢示例 */ SELECT A.ListCode FROM srv_lnk.條碼數據庫名.dbo.ME_ListCode A, IM_BarLend B WHERE A.ListCode=B.Li網站建設教程stCode go /* 刪除鏈接服務器 */ e公司網站建設xec sp_dropserver 'srv_lnk','droplogins'
第二種方法:復制代碼 代碼如下:
exec sp_configure 'show advanced opt個業網站建設公司ions',1 reconfigure exec sp_configure 'Ad Hoc Distributed Queries',1 reconfigure go select * from Product p inner join opendatasource('SQLOLEDB','Data Source=Macaco-Online;user ID=sa;password=sa密碼;').Company.dbo.Product p2 on P.PID=p2.PID go exec sp_configure 'Ad Hoc Distributed Queries',0 reconfigure exec sp_configure 'show advanced options',0 reconfigure go
相關百度seo網站優化seo網站優化。聲明: 本文由我的SEOUC技術文章主頁發布于:2023-05-22 ,文章sqlserver 多表查詢不同數據庫服務器上的表建站知主要講述器上,不同,服務器網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_4437.html