Search code examples
ssissql-server-2012datasetfilenames

In SSIS, add the text file name as a column in the results dataset


Using SSIS, uploading from a text file to SQL Server database table, I need to add the text file name as a column in the results dataset. I am able to create a flat file source, get the data from the file, load into an OLE DB Destination but I am missing the step to add the filename to the dataset.

Basic user using VS, mostly a SQL Production DBA but our developers said to create an SSIS package to upload the daily text file.


Solution

  • In your flat file source, right click on it and go to advanced properties. In the Advanced Properties editor, select the Component Properties tab and then under Custom Properties, there is a FileNameColumnName. Here I used SourceFileName

    enter image description here

    I attached a data viewer between my flat file source and the next component et voilà!

    enter image description here