SQL Agent Job Step Properties GUI - Command field in sysjobsteps and double quotes

I am trying to create a PowerShell script to run sp_upate_jobstep to specifically update the command field for an Agent job running a SSIS step.

The initial setup was done using the GUI in SQL Management Studio 2014.

I have noticed that when I run sp_help_job and retrieve the command field, that there is some what I would call interesting behaviour surrounding some the strings in the command. For example, if the specific value is a alphanumeric string, I get the following:

/Par SomeParameter;ABCD123

But, if there are any none alphanumeric characters, I get the following:

/Par SomeParameter;"\"ABCD_123\""

I would have only expected that kind of behaviour if the specific string had a space in it.

I have done a little bit of testing and have so far confirmed that if I run sp_update_jobstep and exclude the double quotes and the back slash for a string without spaces, such as:

/Par SomeParameter;ABCD_123

sp_update_jobstep still completes and the agent job still runs.

Is anyone able to confirm that this approach is OK? If not, can anyone confirm which scenarios I need to double quote and backslash for? Is it all non alphanumeric?

Cheers



  • Edited by Hoffy73 Monday, September 14, 2015 1:49 AM
September 14th, 2015 1:47am

It looks like working inconsistently, I'd log it to MS Connect.

In the meanwhile, it looks like the \ may need to be checked for and removed, but it must be able to work with the quotes, check.

Free Windows Admin Tool Kit Click here and download it now
September 14th, 2015 9:32am

Thanks for your reply.  I have also discovered that if a hyphen is in the string, the string needs to be double quoted.

At this stage I am going to us a little regex match to search for non Alphanumeric characters and then double quote any string that has these.



  • Edited by Hoffy73 7 hours 28 minutes ago
September 14th, 2015 7:06pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics