ppend 0''s

  • yep, you can do this very easily in your activeX script of Data Transformation task, as long as your database column is a char/varchar field

  • Thanks for the suggestion.  Fortunately, I was able to find a way to do this using a derived column task and expression.

    Example:

    Column    Action               Expression

    TableID Replace(tableID)     (len(tableID) == 3 ? "00" + tableid : TableID

     

    Explanation - the expression above is similar to a case statement.  "?" = if  and ":" = else

    So basically, "(len(tableID) == 3 ?" is the True/False check.  If (len(tableid) == 3  Then "00" + tableID else ":" tableID

  • I found a better way to add 0's to the tableID

    Using derived column task, I add a new column with the following expression.

    RIGHT("0000", 5 - (LEN(TableID))) + TableID

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

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