国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > SQL Server > 正文

sqlserver 多表查詢不同數(shù)據(jù)庫服務(wù)器上的表

2024-08-31 00:57:42
字體:
供稿:網(wǎng)友
第一種方法:

復(fù)制代碼 代碼如下:


/* 創(chuàng)建鏈接服務(wù)器 */
exec sp_addlinkedserver 'srv_lnk','','sqloledb','條碼數(shù)據(jù)庫IP地址'
exec sp_addlinkedsrvlogin 'srv_lnk','false',null,'用戶名','密碼'
go
/* 查詢示例 */
SELECT A.ListCode
FROM srv_lnk.條碼數(shù)據(jù)庫名.dbo.ME_ListCode A, IM_BarLend B
WHERE A.ListCode=B.ListCode
go
/* 刪除鏈接服務(wù)器 */
exec sp_dropserver 'srv_lnk','droplogins'


第二種方法:

復(fù)制代碼 代碼如下:


exec sp_configure 'show advanced options',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

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 六枝特区| 临猗县| 渑池县| 合江县| 崇左市| 宽城| 横山县| 额济纳旗| 大邑县| 平泉县| 西吉县| 漠河县| 泸州市| 洛川县| 那曲县| 河南省| 荣成市| 邻水| 永康市| 武威市| 平山县| 民乐县| 安福县| 门头沟区| 安新县| 上林县| 乌拉特后旗| 太白县| 衢州市| 乌鲁木齐市| 凤冈县| 麻栗坡县| 龙胜| 永年县| 莲花县| 青河县| 区。| 德格县| 灵石县| 德江县| 清河县|