Posts Tagged ‘import’

Alteryx and Tableau to display UK schools data

February 6th, 2014 Comments off

As part of my Alteryx training, following on from my starting out with Alteryx, I decided to try and use it for a real world example to test it out. I recently had a baby so have to start thinking about schools. Luckily the UK government make school performance data public and the excellent Guardian Datablog have tidied it up for me (the data is for 2012, hence now out of date, but good enough for my training in Alteryx). The data contains school address details, local authority details, school size, school religion and multiple measures of performance.

I would like to know which schools are performing well – i.e. their pupils have high attainment in their exams – and then see which streets are within X miles to help guide me which streets I would need to live to get my son into a chosen school. Alteryx has an in built function called Trade Area where it can map show you a chose radius from a point, which is ideal for the schools approximated catchment area analysis.

Radius of 0.3 miles around each school

Radius of 0.3 miles around each school

Each purple dot is a school with the cirle around the dot being the approximate catchment area, although looking at this it appears the catchment area in London will, in reality, be less than 0.3 miles. Read more…

SSIS Import Multiple Files into a Table

June 6th, 2013 7 comments

I have been banging my head against the computer screen today, fighting with SSIS, which can be incredibly unintuitive. Anyway, as usual, the internet eventually came to my rescue so I can post the solution.

My problem was passing the file name as a parameter into a Data Flow Task. The Data Flow Task was part of a For Each Loop, which worked perfectly except from the Data Flow Task, which was hardcoded with the file name. The solution came from and here it is (in case that link breaks in future):

“I recently had a request to import multiple csv files into a database table then move the files to a new folder. Since this was the first time I was using SSIS Packages I had to do a bit of googling to get my head around it. I found a bunch of blogs and other articles on how to do things in SSIS but none of these posts gave me exactly what i required. So i sat down and knuckled in and eventually figured out how to do this using variables. Below is how you can do this:

This article requires you to have the basic knowledge of how to use the IDE for SSIS packages.

First off we need to create our directories

  • Create a folder c:\temp
  • Create a folder c:\temp\data
  • Create a folder c:\temp\data\Archived

Next we need create our variables and set their settings as the diagram below shows.

  1. varSourceFolder
  2. varArchiveFolder
  3. varArchivePath
  4. varFileName
  5. varFilePath


Now on the Control flow place the following items and configure them as the screenshots below show.

  • Foreach Loop Container
  • Data Flow Task (Place inside the Foreach Loop Container)
  • File System Task  (Place inside the Foreach Loop Container)


Now double click on the Data Flow Task, this will take you to the data flow tab.
On the Data Flow place the following items.

  • Flat File Source
  • Ole DB Destination

Now we need to configure the connections for our source file and our destination

  • Double click on the Flat File Source and create a new connection
  • Give the connection a name and browse to a file in the “c:\temp\data” folder (in my case i have a CSV file)
  • Set any other options you may require (in my case I changed the Header row delimiter to | as my CSV is pipe delimited).
  • Select “Columns” and click “Ok”

In order to make the FlatFile connection dynamic we have to configure the ConnectionString Property as an Expression. varFilePath will be updated on each iteration of file in the Foreach Loop Container.

On the connection managers window you will see the connection you have just created.
Select this connection and in the properties pane select expressions and configure the expression as shown in the screenshot below.


  • Now double click the OLE DB Destination and create a new connection.
  • Select the data connection you want to use or create a new one
  • Select your data access mode (mine is table or view)
  • Select the name of the table or view or press new (pressing new will create a new table or view based on the data in your file)
  • Select mappings on the left and map the columns from your file to your database table.
  • Click “Ok”

Remember to link all your items together as seen below.


Now run your package and check the results.

What did we do?

We have just created a SSIS package that looks in a source directory for all files of extension CSV. The package will iterate through each file and import the data in the file to a SQL table in our database, the package will then move the file to the archive directory.

How can I see my results?

You can run a select query on your table in your database and see if you have the expected data. You can also check your c:\temp\data folder and you should notice the files are no longer there, they should now be in the c:\temp\data\Archived folder.

I hope this help you in your experience with SSIS.

Categories: SSIS Tags: , ,