Escape character for /SET option of dtexec

I have a problem setting some variables in a package using the /SET option of dtexec. Specifically when the value I want to set contains a semi-colon. I get an error like:

Argument ""\Package.Variables[User::Delim].Properties[Value];^;"" for option "set" is not valid.

I am guessing that I will have to escape the semi-colons somehow, but with what

Regards,
Lars




Answer this question

Escape character for /SET option of dtexec

  • cblaze22

    You don't show the command but from the error it looks like

    /set "\Package.Variables[User::Delim].Properties[Value];^;"

    instead try

    /set "\Package.Variables[User::Delim].Properties[Value]";"^;"

    This puts the semicolon separator outside the quotes and may allow DTExec to process the argument.

    HTH,

    Matt



  • thief_1

    The above did not work when the string contained spaces. The following has yet not failed though:

    dtexec /SET \Package.Variables[User::TheVariable].Properties[Value];\""; space"\"

    Regards,
    Lars



  • JCLaguna

    The following turned out to be the proper syntax:

    dtexec /SET \Package.Variables[User::TheVariable].Properties[Value];\"^;\"

    Regards,
    Lars



  • Jay23

    I need to pass a parameter to Package, parameter will contain a Date type.

    The syntax that i am using is

    Dtexec /File "Package.dtsx" /Set \Package.Variable[User::The Variable].Properties[Value]

    But it certainly seems is not fine.

    Could anyone advice on this



  • David X Huang

    Matt,

    I am afraid that didn't work either. Any other ideas of how to pass a string containing semi-colons to dtexec using the command line

    This is the output:

    H:\>dtexec /SET "\Package.Variables\[User::TheVariable].Properties[Value]";"^;"
    Microsoft (R) SQL Server Execute Package Utility
    Version 9.00.1399.06 for 32-bit
    Copyright (C) Microsoft Corp 1984-2005. All rights reserved.

    Argument ""\Package.Variables\[User::TheVariable].Properties[Value];^;"" for opt
    ion "set" is not valid.

    H:\>

    Regards,
    Lars



  • StarBrand123

    You don't have a value specified. Try:

    Dtexec /File "Package.dtsx" /Set \Package.Variable[User::The Variable].Properties[Value];"01/01/1900"



  • daniblind

    Sorry I should have been more explicit in my posting. You should try:

    dtexec /SET "\"\Package.Variables\[User::TheVariable].Properties[Value]\";\"^;\""

    The command interpreter strips quotes so the command I showed previously was what DTExec would work with but you have to escape the quotes so that they get to the DTExec parser. The above shows the actual command line with all the escaping.

    HTH,

    Matt




  • Escape character for /SET option of dtexec