I have tried and tried, and can not get linked. I can connect to the server using SSMS, but can not link to it from a local server. Here is my script (replacing things in brackets with pertainent information):
EXEC master.dbo.sp_addlinkedserver @server = N'[servername].database.windows.net', @srvproduct = N'Any', @provider = N'MSDASQL', @datasrc = N'Azure_ODBC1' GO EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname = N'[servername]', @useself = N'False', @locallogin = NULL, @rmtuser = N'[username]', @rmtpassword = '[password]' GO
You can follow the steps to create a linked server for SQL Azure in SQL Server Management Studio by using Object Explorer: Start your Management Studio and choose your SQL Server instance. In the Object Explorer pane, expand the Server Objects, right-click on Linked Servers and then click on New Linked Server.
The Azure SQL MI instance can be configured to access the tables on the SQL Server on the VM via a linked server on MI.
As specified in ckarst second link, there is a solution that works. I am posting it here to save you the trouble to search for it. As suggested by JuanPableJofre in this page Azure feedback :
Using SQL 2014, I was able to do a distributed query between a local SQL server and a SQL Azure. First, I created a Linked-Server:
In security options: (*)
In SSMS entered the following test query:
use [Local_DB] go Select * from [LinkedServerName].[RemoteDB].[dbo].[Remote_Table]
It worked beautifully !!
To summarize, the linked server is created on your local database. The catalog (database name) is important as Azure might not let you specify it in a query (ie: use azureDBName will not work on Azure), so the database name has to be in the catalog.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With