syntax error

All questions about Control-M jobs definitions
Post Reply
User avatar
nbarr007
Nouveau
Nouveau
Posts: 22
Joined: 30 Nov 2007 12:00

syntax error

Post by nbarr007 » 10 Aug 2013 8:59

Guys

It seems that CTRL-M is stripping out %2 from the SQL that should be run and therefore it cannot resolve the correct exit criteria. In this case it should return a 0. We're not sure why CTRL-M would be doing this?

The CTRL-M command is to run:-

osql.exe -d thinkfolio_TST1 -E -S mg1vdbaz06 -n -Q "EXIT (select count(*)%2 from LogEvent where sDescription in ('Starting ExecuteUpdate() with command <49>','Finished ExecuteUpdate() with command <49>') and dtProcessStart > DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) a)”

Yet the sysout log shows:-

osql.exe -d thinkfolio_TST1 -E -S mg1vdbaz06 -n -Q "EXIT (select count(*) from LogEvent where sDescription in ('Starting ExecuteUpdate() with command <49>','Finished ExecuteUpdate() with command <49>') and dtProcessStart > DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) a)”

Any thoughts as to why the %2 maybe missing?, do we need a different syntax?

Thanks

User avatar
cjdesch
Nouveau
Nouveau
Posts: 10
Joined: 16 Jul 2013 12:00

Post by cjdesch » 15 Aug 2013 6:31

Windows Might be stripping it out since windows uses the percent symbol for %variableName% and for paths "\\myserver\myfolder\file%20name.txt". I would look into escape characters like in this post http://stackoverflow.com/questions/1907 ... batch-file. Something like including a space between operators in this instance can make a difference ".... (*) % 2 ..."

Another option would be to run your query using Control-M for Databases directly against the database instead of having to jump through the commandline interface. You would then get to avoid this problem completely.

You could also try packaging it into a script.

User avatar
moldyscull
Nouveau
Nouveau
Posts: 2
Joined: 18 Nov 2013 12:00

Post by moldyscull » 18 Nov 2013 1:38

cjdesch wrote:Windows Might be stripping it out since windows uses the percent symbol for %variableName% and for paths "\\myserver\myfolder\file%20name.txt". I would look into escape characters like in this post http://stackoverflow.com/questions/1907 ... batch-file. Something like including a space between operators in this instance can make a difference ".... (*) % 2 ..."

Another option would be to run your query using Control-M for Databases directly against the database instead of having to jump through the commandline interface. You would then get to avoid this problem completely.

You could also try packaging it into a script.
Thanks for the information! This might help:)

Post Reply