Allow for spaces in flat file name in Connection Manager Expression value

  • My SQL 2008 SSIS pkg is very basic.

    1 Data Flow that uses a SQL Server 2008 table as it's INPUT data source

    1 .csv file as it's OUTPUT data source.

    Pkg runs fine when I specify the Output datasource .csv as C:\MyDirectory\MyFile.csv

    It fails when I specify the Output datasource .csv as C:\My Directory\My File.csv (NOTE the SPACES in the Dir Name and File name)

    The Output data source name is received as a variable in the package and stored as an Expression in the connection manager.

    How can I allow for SPACES in the path name? (a mandatory requiremnet by the user)

    BT
  • Have you tried wrapping quotes around the output data source name variable?

  • Yes.. still getting an error.

    I used this mechanism to wrap double quotes around my variable:

    "\"" + @[User::pDestPathFile] + "\""

    My Variable value is: C:\TRASH\My Trash\My Trash Folder\MyTrash.csv

    (Evaluating the above expression renders: "C:\TRASH\My Trash\My Trash Folder\MyTrash.csv")

    Here's the error at runtime:

    Error: 2009-10-13 09:52:42.93

    Code: 0xC001401E

    Source: E_DH_EXPORT_INFORCECALC_ONEDAY Connection manager "CSVFile"

    Description: The file name ""C:\TRASH\My "Trash\My" "Trash" Folder\MyTrash.csv"" specified in the connection was not valid.

    End Error

    BT
  • Express12 (10/13/2009)


    Yes.. still getting an error.

    Description: The file name ""C:\TRASH\My "Trash\My" "Trash" Folder\MyTrash.csv"" specified in the connection was not valid.

    The extra quotes inside the file name in the error message are odd.

    I put together a quick package to dump a small table to a csv to see what error I'd get. I created 2 variables, TestConPath=Y:\Test Output\ and TestConFile=test out.csv, all without quotes. I assigned the connection string for a destination CSV to be @[User::TestConPath]+ @[User::TestConFile].

    If the TestConPath folder exists, the package completes without an error. If the folder doesn't exist (I renamed it), I get the error:

    [Flat File Destination [127]] Error: Cannot open the datafile "Y:\Test Output\test out.csv".

    Either way, I can't duplicate the error you're getting. Sorry that I can't be of more help.

  • Think I found my issue. I'm invoking the SSIS pkg from a stored proc via DTEXEC.. passing multiple variables into the proc (sourced from a VB GUI)

    The proc in turn uses single quotes to house the variable PathName (which contains spaces)... causing the Pkg to fail..

    When I encllose the variable value in double quotes (tweaked my proc to do this) it runs fine.

    thanks for your assistance.

    BT

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply