
Azure SQL Database: Cross-Database Queries on the Same Server
If you have two databases on the same Azure SQL logical server and try a three-part name query like you would on-prem SQL Server - it won't work. Here's how to set it up using Elastic Query. The setup Server: sql-server-dev-001 Source database: sqldb-prod-001 (where you run queries) Target database: sqldb-dev-001 (where the data lives) 1. Check if cross-database queries work From sqldb-prod-001 , try querying a table in sqldb-dev-001 : SELECT * FROM [ sqldb - dev - 001 ]. SalesLT . vGetAllCategories If you get this error, you need to set up Elastic Query: Reference to database and/or server name in 'sqldb-dev-001.SalesLT.vGetAllCategories' is not supported in this version of SQL Server. 2. Generate a password In Azure Portal, open Cloud Shell and generate a password: openssl rand -base64 40 Copy the output. 3. Store the password in Azure Key Vault Go to your Key Vault, Secrets > Generate/Import : Name: sqldb-dev-001-crossdb-password Value: paste the generated password This gives you a
Continue reading on Dev.to
Opens in a new tab



