Raw File Destination

The Raw File destination writes raw data to a file. Because the format of the data is native to the destination, the data requires no translation and little parsing. This means that the Raw File destination can write data more quickly than other destinations such as the Flat File and the OLE DB destinations.

You can configure the Raw File destination in the following ways:

  • Specify an access mode which is either the name of the file or a variable that contains the name of the file to which the Raw File destination writes.
  • Indicate whether the Raw File destination appends data to an existing file that has the same name or creates a new file.

The Raw File destination is frequently used to write intermediary results of partly processed data between package executions. Storing raw data means that the data can be read quickly by a Raw File source and then further transformed before it is loaded into its final destination. For example, a package might run several times, and each time write raw data to files. Later, a different package can use the Raw File source to read from each file, use a Union All transformation to merge the data into one data set, and then apply additional transformations that summarize the data before loading the data into its final destination such as a SQL Server 2005 table.

Note

The Raw File destination supports null data but not binary large object (BLOB) data.

Note

The Raw File destination does not use a connection manager.

This source has one regular input. It does not support an error output.

Append and New File Options

The WriteOption property includes options to append data to an existing file or create a new file.

Note

An append operation requires the metadata of the appended data to match the metadata of the data already in the file.

The following table describes the available options for the WriteOption property.

Option Description

Append

Appends data to an existing file. The metadata of the appended data must match the file format.

Create always

Always creates a new file.

Create once

Creates a new file. If the file exists, the component fails.

Truncate and append

Truncates an existing file and then writes the data to the file. The metadata of the appended data must match the file format.

Using the Raw File Destination in a Loop

If the data flow that uses the Raw File destination is in a loop, you may want to create the file once and then append data to the file when the loop repeats. To append data to the file, the data that is appended must match the format of the existing file.

To create the file in the first iteration of the loop, and then append rows in the subsequent iterations of the loop, you need to do the following at design time:

  1. Set the WriteOption property to CreateOnce or CreateAlways and run one iteration of the loop. The file is created. This ensures that the metadata of appended data and the file matches.
  2. Reset the WriteOption property to Append and set the ValidateExternalMetadata property to False.

If you use the TruncateAppend option instead of the Append option, it will truncate rows that were added in any previous iteration, and then append new rows. Using the TruncateAppend option also requires that the data matches the file format.

Using the Format of a Nonexisting Raw File

If you want to use the format of an existing raw file but the file is not available at run time, you can specify the existing raw file at design time and this way get the metadata that the Raw File destination requires. Before you deploy the package, set the ValidateExternalMetadata property of the Raw File destination to false. At run time, a new file that has the correct format is created. In this scenario, the package will fail validation at run time if ValidateExternalMetadata is not set to false.

Configuring the Raw File Destination

You can set properties through SSIS Designer or programmatically.

The Advanced Editor dialog box reflects the properties that can be set programmatically. For more information about the properties that you can set in the Advanced Editor dialog box or programmatically, click one of the following topics:

For more information about how to set properties, click one of the following topics:

See Also

Concepts

Raw File Source
Creating Package Data Flow

Other Resources

Integration Services Destinations

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

14 April 2006

New content:
  • Added information about using the Raw File destination in a loop.
Changed content:
  • Corrected description of the option, Create once.