0

The creation of a SQL Server External Table requires remote tables to be made accessible by running code of the following format on the local database:

CREATE EXTERNAL TABLE [TABLE_NAME]
(
    [Id] [int] NOT NULL,
    [Name] [int] NULL,
)
WITH (DATA_SOURCE = [EXTERNAL_DB_NAME])

I have a quite a few external tables to work with, and am wondering if this functionality can be automated. So, is there a way to create the text for a CREATE TABLE statement from the Information Schema views on the remote database ? This could then be altered and used to populate a dynamic query to be run on the local database.

0 Answers0