Results 1 to 6 of 6

Thread: Adding Leading 0's in SSIS through Expression

  1. #1
    Join Date
    Aug 2011
    Posts
    3

    Adding Leading 0's in SSIS through Expression

    Hi All,

    Issue seems to be simple - but i am trying too hard to find a solution for this .. any help would be greatly appreciated.

    I am trying to add leading 0's in my destination table --> I get data from csv file and the destination is table.

    I used to derived columns to change the column for example I have a "Record Type" which has input 1 and when it is loaded in the table it has to be "01". I used derived columns and gave the following expression:

    (DT_WSTR,2)(RIGHT("00" + (DT_WSTR,2)[Record Type],2))

    I also tried using Replicate with other functions - but i am not getting the desired result.

    Note: Data type of "Record Type" Which comes has an input is DT_I2.

    Thanks in advance.

    Regards,
    varun

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Don't think DT_I2 is valid data type in sql server.

  3. #3
    Join Date
    Aug 2011
    Posts
    3

    @rmiao

    Thanks for your reply.. could you please give me some suggestion on how to handle this .. little bit more elaborate - thanks

  4. #4
    Join Date
    Sep 2002
    Posts
    5,938
    Which rdbms is your destination table on?

  5. #5
    Join Date
    Dec 2011
    Location
    Austria
    Posts
    6

    Adding Leading 0s in SSIS through Expression

    I tried using Citadel and I had it working for email however I could never get spamassassin to work with it so I gave up on it.

    If I go back to Citadel how do I get my mail that is in the Maildir folder to it and do you have any hints on how to get spamassassin to work with it?

  6. #6
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Your destination column type needs to be CHAR for leading 0 to work. You will have to use CONVERT or CAST to change input data type to CHAR as well.
    Last edited by skhanal; 12-07-2011 at 01:36 PM.

Tags for this Thread

Posting Permissions

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