Import Flat File to SQL with Existing Connection

I have a file we will call Lab which is a pipe delimited file.

I need to import this file to a table in SQL called Lab, I have already created the connection. I want to also have the file name mapped to a column Filename.

This does not appear to be covered in a tutorial, would appreciate some help.

Hello Richard and welcome to the Community!

I'm not sure I understand your question clearly. Are you having a problem with importing a file, or exporting it into a database, or adding a column with the file name?

Please clarify. A screenshot or two would help too.

Good evening,

I have attached a screen shot to show where I get stuck.

I have a text file called lab and I want to import this text file to a table in SQL Sever called Lab.

Where I am getting stuck is I can get the file to load here, I do not know how to get it to load to one of the databases that I have a connection to.

The software is reading the data correctly and the destination table is empty, I am just struggling with how to tell Easymorph to load the text file lab to the SQL table named lab.

For your reference I have attached a copy of the screen shot where I get stuck and a sample of the file that I created.

Sample_Data.txt (306 Bytes)

Thank you for the clarification, Richard.

Did you have a chance to see this tutorial article? EasyMorph | Exporting data into a database

It explains how you can use the "Export to database" action to push your data into a database table.

Let me know if you get stuck at any point. I'm here to help you.

I am trying to run a two part process, the first part deletes everything in the staging table and then the second part exports the data from the text file into the table in SQL.

The first part works using database commands.

I have taken your advice and I am able to follow the directions on the Export to database piece. Where I need help now is when I define the table name, I am still not given the option to map the column names.

For your reference I have taken two sets of screen shots, I have tried this by entering in a parameter and by entering in the file name. In both cases as you can see I am not given the option to map the columns which according the instructions I should be able to.

The error message I get is that at least one column must be selected.

For the purpose of consistency I am using the same sample file.

Any help is appreciated.

A simple option - you can use two separate parameters, one for the file path and another for the database table name. In this case, you will need to enter both parameters manually.

Alternatively, you can produce the table name using a calculated parameter with an expression that extracts just the file name from the first parameter (that is used for the file path). The expression for calculating the parameter can be, for instance, as below:


To learn more about calculated parameters, read this tutorial article: EasyMorph | Parameters