MSSQL LINK SERVER TO AZURE sql database
------ Configure the linked server
-- Add one Windows Azure SQL DB as Linked Server
EXEC sp_addlinkedserver @server='test', -- here you can specify the name of the linked server
@srvproduct='test',
@provider='sqlncli', -- using SQL Server Native Client
@datasrc='XXX.database.windows.net,1433', -- add here your server name
@location='',
@provstr='',
@catalog='BBB' -- add here your database name as initial catalog (you cannot connect to the master database)
-- Add credentials and options to this linked server
EXEC sp_addlinkedsrvlogin
@rmtsrvname = 'test',
@useself = 'false',
@rmtuser = 'sa', -- add here your login on Azure DB
@rmtpassword = 'pw' -- add here your password on Azure DB
EXEC sp_serveroption 'test', 'rpc out', true;
------ Now you can use the linked server to execute 4-part queries
-- Query the data using 4-part names
select * from [test].DBNAME.dbo.TABLENAME
以上內容,若有錯誤
煩請各路高手路過指正
謝謝!
<(_ _)>