question

SruthiKathara-0372 avatar image
0 Votes"
SruthiKathara-0372 asked KalyanChanumolu-MSFT commented

Cross Database query from Azure SQL database to SQL server on Azure VM

Hi,

Is is possible to run a query from Azure SQL Database to SQL server on Azure VM?
If not what will be the best way to select data from Azure SQL database to a table on Azure VM ?

Thanks,
Sruthi

azure-sql-database
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AlbertoMorillo avatar image
0 Votes"
AlbertoMorillo answered

You cannot use a cross database query from Azure SQL that access data on a table located on Azure SQL VM. However, you can use SQL Data Sync to sync data tables between SQL Server VM and Azure SQL. Data sync can be one direction or bi-directional. You can then consume the data locally as it is synced by SQL Data Sync

If you want to run queries from SQL Server Azure VM involving tables located on Azure SQL, you can create linked servers as explained here, but performance may be an issue with large data sets.

You can also considerate Transactional replication as an alternative.

Hope this helps.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

KalyanChanumolu-MSFT avatar image
0 Votes"
KalyanChanumolu-MSFT answered

@SruthiKathara-0372 As confirmed by Alberto, it is not possible to query an on-premises SQL Server from an Azure SQL Database.

If you must query the on-premises SQL Server within the context of a transaction and cannot afford any latency with replication or data sync, you may want to choose Azure SQL Managed Instance instead of Azure SQL Database.

With Azure SQL Managed Instance, you can add a linked server to your on-premises SQL Server Database


If an answer is helpful, please "Accept answer" or "Up-Vote" which might help other community members reading this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.