sql-serverssisdts

SSIS Dynamic File Path


New to SSIS and trying to create a variable file path without a lot of joy, sure once I get it figured out once I will fine going forward, so any assistance would be great.

So I have a Variable @[User::RvS_MonthVar] which would be 202006

So I am trying

"...\Reports\" + substring(@[User::RvS_MonthVar],1,4) + "\" + @[User::RvS_MonthVar] + "\" + "CN03.xls"

But I get an error

The Token "\" is not recognised

Thanks in advance


Solution

  • \ is an escape character in SSIS Expressions, you need to "double them up" when using them. For example:

    "C:\\YourDirectory\\Reports" + @[User::Directory] + "\\" + @[User:FileName]