CREATE EXTERNAL TABLE AS SELECT
CREATE EXTERNAL TABLE AS SELECT: exports query results to storage
What changes
- Input
- a SELECT query
- Output or change
- external files plus an external table definition
Syntax at a glance
CREATE EXTERNAL TABLE { [ [ database_name . [ schema_name ] . ] | schema_name . ] table_name } [ (column_name [ , ...n ] ) ] WITH ( LOCATION = 'hdfs_folder' | '<prefix>://<path>[:<port>]' , DATA_SOURCE = external_data_source_name , FILE_FORMAT = external_file_format_name [ , <reject_options> [ , ...n ] ] ) AS <select_statement> [;]
Work example
An export job must write query results to an external data location.
Review the selected columns, destination path, file format, overwrite behavior, and data classification.
Check your work The output contains only approved fields and lands in the intended destination.
Open Microsoft Learn for full syntax, permissions, and details for your version.