Thursday, March 22, 2012

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

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

|||

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

|||

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

|||

The following turned out to be the proper syntax:

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

Regards,
Lars

|||

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

sql

No comments:

Post a Comment