I've been following this article here:
http://blogs.msdn.com/b/sqlcat/archive/2011/03/08/linked-servers-to-sql-azure.aspx
on how to setup a Linked Server from SQL Server 2008 R2 to an SQL Azure instance. I am using SQL Native Client 10.0 as the ODBC driver and judging by the default databases that are shown the connection is valid; however when I attempt to establish a linked server as the above article suggests; I get the following error:
OLE DB provider "MSDASQL" for linked server "Azure_Test" returned message "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".
Now I've seen a few forum posts (Nothing conclusive unfortunately) suggesting it may be a 64bit issue. Has anyone successfully setup a Linked Server to SQL Azure from a local instance?
EDIT: Davids answer was indeed correct; just thought I'd share this awesomeness I found you can do now with a linked server:
DELETE OPENQUERY (AzureTest,
'SELECT * FROM [AzureDB].static.MyTable');
INSERT OPENQUERY (AzureTest,
'SELECT * FROM [AzureDB].static.MyTable')
SELECT *
FROM static.MyTable
SELECT * FROM OPENQUERY(AzureTest, 'SELECT * FROM [AzureDB].static.MyTable')
If the application persistently fails to connect to Azure SQL Database, it usually indicates an issue with one of the following: Firewall configuration. The Azure SQL database or client-side firewall is blocking connections to Azure SQL Database.
Linked servers are available in SQL Server Database Engine and Azure SQL Managed Instance.
Open SQL Server Management Studio and connect to an instance of SQL Server. In the Object Explorer, expand the node for the SQL Server database. In the Server Objects node, right-click Linked Servers and click New Linked Server. The New Linked Server dialog is displayed.
I have done this, following the steps that are listed in the document that you linked to.
Here were the two SQL statements that I needed to make it work for me:
EXEC master.dbo.sp_addlinkedserver @server = N'Azure_ODBC1',@srvproduct=N'Any', @provider=N'MSDASQL', @datasrc=N'MY Azure'
GO
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'Azure_ODBC1',
@useself=N'False',@locallogin=NULL,@rmtuser=N'piqBackup@azureServer',@rmtpassword='########'
GO
I set my ODBC connection up as a SYSTEM DSN (I originally set it as a User DSN and had some issues). I just used my server name (no 'tcp:' in front) -- azureServer.database.windows.net. Once I set up the DSN and ran the three statements above, it worked fine. I could execute this statement without issue:
SELECT * FROM Azure_ODBC1.piqBackupData.dbo.BackupData
I'm not sure if this helps or not - but I hope it does. Good luck!
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