Showing posts with label fullfilepath. Show all posts
Showing posts with label fullfilepath. Show all posts

Friday, March 9, 2012

pass variable with a space

Hi,

I am passing a filename to a command in sql.

The problem is that it gives an error if the @.FullFilePath has a space in it.

set @.cmd = 'dtexec /f ' + @.FullPackagePath + ' /set \Package.Variables[User::FileName].Properties[Value];' + @.FullFilePath + '"'

print @.cmd

Thanks

As with everything, use quotes... ""|||

This is the stored procedure which passes the filename

uspCEMTradeExecutePackage 'd:\sysappl\CEM\SSIS\Imports\Trades\csa.dtsx', 'CSA data.csv'

Notice the filename, i.e. 'CSA data.csv'

It has a space in it.

Do you mean the call to the stored procedure should be:

uspCEMTradeExecutePackage 'd:\sysappl\CEM\SSIS\Imports\Trades\csa.dtsx', '"CSA data.csv"'

this does not seem correct.

Thanks

|||

That is correct, you need the single quotes outside of the double quotes. When you call DTEXEC with a variable or path that has spaces in it, it has to be wrapped in double quotes.

Or you could change the command line to include the double quotes:

Code Snippet

set @.cmd = 'dtexec /f ' + @.FullPackagePath + ' /set \Package.Variables[User::FileName].Properties[Value];"' + @.FullFilePath + '"'