SSIS Execute SQL Task using File Connection

This SSIS Integration Services article shows how to Execute SQL Tasks using the File Connection, which helps to execute queries within the file system.

The below sql file shows the query that creates a table (if it does not exist) and inserts a few records into it.

Query File

Drag and drop Execute SQL Task onto the control flow region.

Execute SQL Task

Double-click to open the editor. In this SSIS example, we chose the existing Connection. However, you can create a new one.

Create a Connection

Change the SQL Source Type to File connection.

SSIS Execute SQL Task using File Connection4

Click the button to open the File Connection Manager Editor.

File Connection Manager

Use the Browse button to choose the sql file for the local hard drive.

Select the Query File

Click OK to close the Execute SQL Task editor.

SSIS Execute SQL Task using Query File Connection 7

Run the SSIS Execute SQL Task using File Connection Package.

Run SSIS Execute SQL Task using File Connection

Open the SQL Management Studio to view the newly created table from the SQL file and the inserted records.

Result

Let me edit the file and rerun the package.

Edit File

Table result.

Output