CREATE EXTERNAL TABLE
defines an external table
What changes
- Input
- external data source and file format
- Output or change
- external table definition over files or remote data
Syntax at a glance
CREATE EXTERNAL TABLE { database_name.schema_name.table_name | schema_name.table_name | table_name } ( <column_definition> [ , ...n ] ) WITH ( LOCATION = 'folder_or_filepath' , DATA_SOURCE = external_data_source_name , [ FILE_FORMAT = external_file_format_name ] [ , <reject_options> [ , ...n ] ] ) [ ; ]
Work example
A query needs a relational schema over data stored outside the database.
Compare external column types, file format, location, credentials, and remote schema using synthetic rows.
Check your work A small read returns the expected columns and row count from the approved source.
Open Microsoft Learn for full syntax, permissions, and details for your version.