Results 1 to 2 of 2

Thread: Left padding

  1. #1
    Join Date
    Jun 2004

    Unanswered: Left padding


    I want to do fill zeros in a character field.

    I am trying right('0000000000'||input field,10) , it seems to work except that it is giving some junk and the result...

    Please let me know how can i zero pad a varchar field of length(10).

    Thanks for your help

  2. #2
    Join Date
    Dec 2005
    the result of your operation will be a VAR CHAR(20) - field.

    To get CHAR(10) add a CAST-operation:

    CAST ( right('0000000000'||input field,10) AS CHAR(10) )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts