TEXT#

Querona reads plain-text files from a File connection. Every text file (.txt by default) in the connection’s folders becomes a row in the built-in builtin.TextFiles table, with the file’s full content in the Text column. You can also read text files ad-hoc — without importing metadata — with OPENROWSET (BULK …) and FORMAT = 'TEXT'.

The TextFiles table#

Column name

Column type

Description

Name

NVarChar(255) null

File name with extension

SizeBytes

BigInt not null

File size in bytes

Path

NVarChar(4000) not null

OS file path

Encoding

VarChar(50) null

Character encoding detected for the file

Type

NVarChar(30) null

File extension

Text

NVarChar(max) null

Full file content

The character encoding is detected per file, or fixed on the connection. The accepted text-file extensions are also set on the connection.

Reading text files#

-- built-in table
SELECT Name, Encoding, Text FROM builtin.TextFiles;

-- ad-hoc, one or more files
SELECT Path, Text
  FROM OPENROWSET(BULK '*.txt', DATA_SOURCE = 'files', FORMAT = 'TEXT') AS docs;

DATA_SOURCE names the File connection; a file reference is resolved under its directory, and a reference that escapes it is rejected. See Files and data services for connection setup and folder-to-schema mapping.

See also#