Load Alteryx Text File into SQL Server

This section explains the step to load the Alteryx text file into the SQL Server table. In the Alteryx Read Text File article, we presented the process to read the text file and consider it a continuation.

Drag the Input Data and choose the Customers_text file. The following image shows the data within that file.

Load Alteryx Text File into SQL Server 1

Steps to load Alteryx Text File into SQL Server

From the Favorites tab, drop the Output Data into the Canvas.

Load Alteryx Text File into SQL 2

Connect the Input Data to Output Data, and click the down arrow to write the data to a file or database.

Load Text File into SQL Server 3

Within the Data Connections window, Go to the Data Sources tab to select the required connection. Here, we want to load a text file to SQL Server, so select ODBC connection.

Load Alteryx Text File into SQL Server 5

Please provide the unique connection name, Server Name or Hostname, Authentication (Windows or SQL), and the default Database name. If you choose the SQL Authentication, provide the username and password.

Load Alteryx Text File into SQL Server 6

Here, we assigned SQLDBConnection as the connection Name, our Server name PRASAD as host, and SQL authentication. Don’t forget to click the test button to check the connection is successful or not.

Load Alteryx Text File into SQL Server 7

We selected the SQLTEST database as the default database.

Load Alteryx Text File into SQL Server 8

Click OK to close the SQL Server Database Connection window.

Load Alteryx Text File into SQL Server 9

Next, it will ask to enter the output table name. Here, we entered AlteryxCustomersText as the output SQL table name.

Load Alteryx Txt File into SQL Server 10

The following screenshot shows the configuration setting of the SQL output data.

Load Alteryx Text File into SQL Server 11

Under the Output options, you have an opportunity to perform CRUD operations on the above table. For example, you can create a new table, drop and recreate it, append it to an existing table, update records, etc.

Load Alteryx Text File into SQL Server 12

We left the option to create a table and hit the run button.

Load Alteryx Text File into SQL Server 13

Within the Management Studio, you can see the result.

Load Alteryx Text File into SQL Server 14

There are two essential options available in the SQL configuration tab, and we show you an example to use them.

  • Pre Create SQL Statement: It runs before performing SQL operations. We used a drop statement to delete the existing table.
  • Post Create SQL Statement: It runs after performing SQL operations. We used Delete Statement to delete customers whose occupation is Clerical.
Load Alteryx Text File into SQL Server 15

Hit the run button and see the messages.

Load Alteryx Text File into SQL Server 16

As you can see, Alteryx loaded all the 15 records and then deleted the customers whose occupation is clerical.

Load Alteryx Text File into SQL Server 17