SQL Agent job TIME token - leading zeroes removed

  • I'm using "$(ESCAPE_NONE(DATE))$(ESCAPE_NONE(TIME))" in a job step which, according to the documentation, is supposed to be the date in YYMMDD format and the time in HHMMSS format. However, the stored procedure I'm running (which has a VARCHAR parameter) is getting:

    • YYYYMMDDHHMMSS - when the hour is between 10 and 23
    • YYYYMMDDHMMSS - when the hour is between 1 and 9
    • YYYYMMDDHHMM - when the hour is 0

    So basically it's treating the time as an integer and stripping the leading "0"s

    How can I stop this happening?

  • Not sure about stopping it, but looks easy enough to handle in the proc, based on the differing lengths of the incoming string.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Yeah I've already implemented a workaround in this case but wanted to know for future implementations where this might not be possible.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply