READ_FILE_TEXT Function

Reads the contents of a text file and returns it as a single string representing the whole file.

Syntax

READ_FILE_TEXT(file-path, [file-encoding])

Parameters

Return Value

Contents of the file as a text string.

Example

-- Auto-detected Unicode file encoding.
PRINT READ_FILE_TEXT('C:\MyFile.txt');

-- Produces a 1-row query result with file contents read
-- using the Japanese Shift-JIS encoding (code page 932).
SELECT READ_FILE_TEXT('C:\ShiftJIS.txt', 932) AS data;