2010年10月25日 星期一

在 SQL Server 中設定Oracle的連結伺服器

-- Adding linked server (from SQL Server Books Online):
/* sp_addlinkedserver [@server =] 'server'
[, [@srvproduct =] 'product_name']
[, [@provider =] 'provider_name']
[, [@datasrc =] 'data_source']
[, [@location =] 'location'] [, [@provstr =] 'provider_string']
[, [@catalog =] 'catalog']
*/

EXEC sp_addlinkedserver 'XXIM','Oracle','MSDAORA','xxim'

-- Adding linked server login:
/* sp_addlinkedsrvlogin [@rmtsrvname =] 'rmtsrvname'
[,[@useself =] 'useself']
[,[@locallogin =] 'locallogin']
[,[@rmtuser =] 'rmtuser']
[,[@rmtpassword =] 'rmtpassword']
*/
EXEC sp_addlinkedsrvlogin 'XXIM','FALSE' ,NULL,'xxim','xxim'
--TEST
SELECT * FROM OPENQUERY(XXIM,'SELECT * FROM LOGS')

沒有留言:

張貼留言