Store a value in an int column with leading zero?

  • I have a SAP character-based code that reads 044. When I pass that value to SAP it has to be 044 not 44.

    Unfortunately, the SQL Server table has that column defined as int so 044 is stored as 44. Passing 44 to SAP results in an error as SAP does not treat 044 = 44.

    Given the fact that we cannot change the data type of the column

    without a lot of application code, stored proc, function changes, is there a way to store leading zeros in an int so that upon selecting that value, it is 044 instead of 44?

    Thank you.

  • when passing to value to SAP just cast it as varchar, adding the leading zero.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • Thanks, that was exactly what we were contemplating.

  • MissyDaisy (9/18/2009)


    Thanks, that was exactly what we were contemplating.

    ... way to go 😉

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

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

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