ikilledbill
ikilledbill

Reputation: 241

How to Import Just The FileName into SQL via SSIS

I am trying to write a file name to a table in my database - at the moment all I am achieving is importing the whole file path.

I have a foreach loop, which on the Collection looks in a specific folder and for a specific file type (the retrieve file name is fully qualified)

This has a variable mapping to "ImportInvoiceFilePath"

Then within that is a Data Flow Task which includes the flat file source, a derived column which creates the file path in the database. This works fine - but what I am trying really hard to do but can't work out is how do I get just the file name (no extension) to write to the database as well?

Upvotes: 1

Views: 48

Answers (1)

ikilledbill
ikilledbill

Reputation: 241

Literally worked it out. Set my forloop to nameonly then in my connection to my Source file under expressions put:

@[User::ProcessingInvoiceFilePath] + "\\"+@[User::ImportInvoiceFileName]+".saf"

Where saf is the file type

Upvotes: 1

Related Questions