sys.external_file_formats#
Returns one row for every user-defined external file format of the named virtual database - the current one for
sys.external_file_formats, another one for otherdb.sys.external_file_formats. Formats are created with
CREATE EXTERNAL FILE FORMAT. The view takes
its name, shape and column types from SQL Server’s sys.external_file_formats.
The built-in formats (csv, tsv, parquet) are not listed: they are not objects of any database, so a tool
that lists a database’s objects never scripts, drops or recreates them.
Column name |
Data type |
Description |
|---|---|---|
file_format_id |
int |
Identifier of the format, unique within the database. User-defined formats start at 65536; an id is never reused. |
name |
sysname |
Name of the format. |
format_type |
nvarchar(100) |
The FORMAT_TYPE as it was typed: |
field_terminator |
nvarchar(10) |
The declared FIELD_TERMINATOR, |
string_delimiter |
nvarchar(10) |
The declared STRING_DELIMITER, or the empty string when omitted. |
date_format |
nvarchar(50) |
The declared DATE_FORMAT (a culture name or a pattern), or the empty string when omitted. |
use_type_default |
bit |
The declared USE_TYPE_DEFAULT, or |
serde_method |
nvarchar(255) |
Always |
row_terminator |
nvarchar(10) |
The two characters |
encoding |
nvarchar(10) |
The declared ENCODING, |
data_compression |
nvarchar(255) |
The declared DATA_COMPRESSION codec, or |
first_row |
int |
The declared FIRST_ROW, |
parser_version |
nvarchar(32) |
Always |
The defaults above are the values SQL Server 2025 stores for an omitted option; the Engine stores an omitted option as not declared and fills the default in here, so a declaration and its listing read the same on both systems.
One difference from SQL Server: when a declaration repeats FORMAT_TYPE and an earlier occurrence is DELIMITEDTEXT
while the last one is not (FORMAT_TYPE = DELIMITEDTEXT, FORMAT_TYPE = PARQUET), SQL Server lists the format with
the delimited-text defaults (|, \n, UTF8, 1) although it is a PARQUET format, while the Engine
lists NULL in those four columns. The format behaves the same on both systems; only the listing differs.
Permissions#
The view lists the formats of a database the caller can see; no other permission is required.
Example#
SELECT name, format_type, field_terminator, string_delimiter, first_row, encoding, date_format
FROM sys.external_file_formats;