Implied Zeros? How do I convert into...

  • Hi people,

    I am trying to DTS into a text file and one of my outputs needs to convert a number (3625.00) into 003625.  I have absolutely no idea what implied zeros are (did I miss that day at school) but am told this is how the figure needs to look.

    Oh, and the destination column is fixed width...please help?

    Thanks.

    JG

  • How bout something like:

    CAST(CAST(REPLICATE('0', 6 - LEN(@Field)) + @Field AS VARCHAR(6)) AS VARCHAR(6))



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • You can try this from an ActiveX Transform:

    Function Main()

    DIM sTemp

    DIM sSource

    DIM sOutput

     sTemp = "000000"

     sSource = "1234"

     sOutput = LEFT(sTemp,(LEN(sTemp) - LEN(sSource))) & sSource

     msgbox"Value = " & sOutput

     Main = DTSTaskExecResult_Success

    End Function

  • Thanks a lot guys - both ways will resolve and I'll keep them in my library.

    Cheers,

    JG

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

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