SSIS Raw File Reader: How to Use Raw File Source and Destination

5 min read

The SSIS Raw File Source reads the binary .raw format that only the Raw File Destination produces; it skips text parsing, so it is fast for staging data between package executions. You create the file with Raw File Destination, then map its columns in Raw File Source and set the file name in the editor.

When you have a .raw file in a Data Flow, the Source gives you the columns that already exist inside the file. This guide was tested on SQL Server 2019 CU18 with SQL Server Data Tools.

On this page
  1. What the SSIS Raw File Reader does
  2. SSIS Raw File vs Flat File Source: How They Compare
  3. Create a .raw file with the SSIS Raw File Destination
  4. Read the .raw file with the Raw File Source
  5. Raw File Source configuration and column mapping
  6. When to use raw files, and when not
  7. Common errors with raw files
  8. FAQ
  9. Sources

What the SSIS Raw File Reader does

The SSIS Raw File Source reads a binary .raw file that was written by the Raw File Destination. The file stores column values and metadata in SSIS's native format, so the Source does not parse text delimiters, encodings, or data-type conversions. Column definitions come from the file itself, not from a separate schema or connection manager. Because only the Raw File Source can read this format reliably, the .raw file is an internal staging format, not a general interchange format.

SSIS Raw File vs Flat File Source: How They Compare

The Flat File Source reads text data from delimited or fixed-position files. Raw files are binary and internal to SSIS. The table below summarises the practical differences.

AspectRaw File SourceFlat File Source
FormatBinary .raw file written by Raw File DestinationText file, delimited or fixed-position
ParsingNone; reads native SSIS binary values directlyParses delimiters, text qualifiers, and data types
PerformanceFast for staging because it avoids parsing overheadSlower for large imports because parsing costs CPU
PortabilityTied to SSIS; the binary layout is internalPortable text; any ETL tool or editor can open it
Use caseTemporary storage between package executions on the same serverImports from external systems, CSV, logs, and flat files

Portability differences matter outside SSIS. A flat file can be opened and understood by another system; a raw file cannot. The speed difference depends on data volumes and data types; no fixed multiplier applies to every package.

Create a .raw file with the SSIS Raw File Destination

Add a Raw File Destination to a Data Flow Task to persist the current pipeline data.

  1. Open a Data Flow Task in SQL Server Data Tools.
  2. Drag a Raw File Destination onto the Data Flow design surface.
  3. Connect it to an upstream source or transformation.
  4. Open the editor and set AccessMode and the Raw File Name, or the variable that holds the file path.
  5. On the Columns page, select the columns you want to persist.
  6. Execute the package.

When the package runs, SSIS writes the selected column values and their metadata to the .raw file. The file is not meant to be edited or unpacked outside SSIS.

Read the .raw file with the Raw File Source

Use a Raw File Source whenever you need to bring the stored data back into a Data Flow.

  1. Open a Data Flow Task in SQL Server Data Tools.
  2. Drag a Raw File Source onto the Data Flow design surface.
  3. Open the editor and set the .raw file path, either directly in Raw File Name or through a variable.
  4. Review the columns on the Columns page; they come from embedded metadata in the file.
  5. Connect the Source output to the destination or transformation that will use the data.
  6. Execute the package.

You do not define a schema separately. The Source reads the column names, data types, and order from the file itself.

Raw File Source configuration and column mapping

The Raw File Source editor exposes two settings that control where the data comes from, and a column mapping page that controls what leaves the component.

  • AccessMode: selects a fixed file name or a package variable that supplies the file name at runtime.
  • Raw File Name: the path to the .raw file when AccessMode uses a fixed file.
  • Variable name: the package variable that holds the file path when AccessMode uses a variable.

Changing from a fixed file name to a variable does not change the embedded column metadata. The replacement file must match the schema that was present in the original .raw file, otherwise the Data Flow fails validation before it runs.

When to use raw files, and when not

Use raw files for temporary, same-server staging between SSIS executions.

  • Use them when a package writes data that another package or execution will read later on the same server.
  • Use them when you want a fast binary handoff without text parsing.
  • Do not use them for long-term storage; the format is internal to SSIS.
  • Do not use them to exchange data with non-SSIS systems.
  • Do not treat them as portable files that can be moved freely across SSIS versions without testing.
  • Test raw-file packages when moving between SQL Server versions; behaviour differs before 2016 SP1.

Common errors with raw files

Raw File Source failures are usually about the file or the metadata that goes with it.

  • File not found — the path set in Raw File Name does not exist, or the variable is empty at runtime.
  • Metadata mismatch — the file was created with a different set of columns, data types, or order than the Source expects.
  • File in use — another process or package execution still has the file open; close the process and retry.

Check Raw File Name and any package variable value before execution; a blank variable produces a file-not-found style error. Fix the path, recreate the file with the correct Destination mapping, or ensure the file is not locked before the package runs.

FAQ

What is an SSIS raw file?

An SSIS raw file is a binary file written by Raw File Destination and read by Raw File Source. It stores column values and metadata in SSIS's native format.

How do I read a .raw file in SSIS?

Add a Raw File Source to the Data Flow, point it to the .raw file, and run the package. The Source reads the column definitions from the file's embedded metadata.

What is the difference between raw file and flat file in SSIS?

Raw files are binary and internal to SSIS, with no text parsing. Flat files are text files with delimiters or fixed positions that require parsing.

Can I open an SSIS raw file outside Integration Services?

No. Only the Raw File Source can read an SSIS raw file reliably, according to Microsoft Learn.

How do I create a raw file in SSIS?

Add Raw File Destination to a Data Flow, select the columns to persist, set the file path, and execute the package.

Sources

  • Raw File Source — Microsoft Learn
  • Raw File Destination — Microsoft Learn
  • Flat File Source — Microsoft Learn
SQL blogcasts

SET_NOCOUNT_ON

Technical notes on SQL Server for DBAs and developers: why a query or job behaves as it does and how to fix it, with T-SQL that runs and the version it was tested on.

More notes

Go up