1

I am migrating all my VM Sql Server 2012 database to Azure Sql Database. In my current structure I am using cross database queries to fetch data from different database tables.

I have created external table to my parent table using below query

CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'yourPassword';  

CREATE DATABASE SCOPED CREDENTIAL yourServeradminlogin  
WITH IDENTITY = 'yourServeradminlogin',  
SECRET = 'yourPassword';  

CREATE EXTERNAL DATA SOURCE RefmyDemoDB2  
WITH  
(  
    TYPE=RDBMS,  
    LOCATION='testdbdemoserver.database.windows.net',  
    DATABASE_NAME='myDemoDB2',  
    CREDENTIAL= yourServeradminlogin  
);  
CREATE EXTERNAL TABLE [dbo].[Department](  
    [DeptId] [int] NOT NULL,  
    [Name] [varchar](50) NULL  
)  
WITH  
(  
    DATA_SOURCE = RefmyDemoDB2  
);  


/****** Script for SelectTopNRows command from SSMS  ******/  
SELECT *  
  FROM [dbo].[Employee] E  
  INNER JOIN [dbo].[Department] D  
  ON E.DeptId = D.DeptId

I referred this link https://www.c-sharpcorner.com/article/cross-database-queries-in-azure-sql/

But when I create external table it doesn't shows table in external table folder like shown in below image. enter image description here

In my case it directly showing in Tables folder.

Anyone knows why I don't see Department table in External Tables folder? How can I add such tables in External Tables folder?

1 Answer 1

1

External tables are available in Azure SQL only to support a feature called "Elastic Queries", that may solve your problem:

https://learn.microsoft.com/en-us/azure/sql-database/sql-database-elastic-query-overview

If this is not enough for you, and you really need full cross-database query support, you have to use an Azure SQL Managed Instance:

https://learn.microsoft.com/en-us/azure/sql-database/sql-database-managed-instance

which seems to be exactly what you need.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks for reply. I have Azure Sql. I followed all steps mentions in link but still tables not showing in external tables folder.
I have SQL Server Management Studio 2012 locally installed on my machine. I use it to connect to Azure Sql Server. And it shows list of database created on Azure Sql Server
SQL Server Management Studio 2012 is not aware of external table existence. You need to update to SQL Server Management Studio 2016 or 2017. Here's the link: learn.microsoft.com/en-us/sql/ssms/…
Thanks for reply. Yeah yesterday I have installed 2017 and now it is showing me everything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.