本文實(shí)例講述了SQLSERVER簡(jiǎn)單創(chuàng)建DBLINK操作遠(yuǎn)程服務(wù)器數(shù)據(jù)庫(kù)的方法。分享給大家供大家參考,具體如下:
--配置SQLSERVER數(shù)據(jù)庫(kù)的DBLINK
exec sp_addlinkedserver @server='WAS_SMS',@srvproduct='',@provider='SQLOLEDB',@datasrc='10.131.20.100'
exec sp_addlinkedsrvlogin 'WAS_SMS','false', NULL,'CustomSMS','SqlGdn@InfoxMas2008'
select top 100 * from AS400.AS400_Extract.DBO.ORDUNA
--配置SQLSERVER到MYSQL數(shù)據(jù)庫(kù)的DBLINK
exec sp_addlinkedserver @server = 'mysqltest', @srvproduct='mysql',@provider = 'msdasql', @datasrc = 'MY_TOMATO'
exec sp_addlinkedsrvlogin @rmtsrvname='mysqltest',@useself=false,@locallogin='本地?cái)?shù)據(jù)庫(kù)的登陸用戶',@rmtuser='MYSQL的用戶名稱',@rmtpassword='MYSQL的用戶密碼'
select * from openquery(mysqltest,'select * from marketing_data')
--這里的 MY_TOMATO是在WINDSOWS系統(tǒng)管理臺(tái)中進(jìn)行配置的ODBC,在SYSTEM DNS里增加的!