Conditionally create unique id in SSIS

  • Hi !

    I am importing data from text file using SSIS package. As a result it creates records in the table" Loads" .ROWNUM IS IDENTITY column to preserve original order.Import always like that:

    ROWNUM,TYPE, AMT,

    1 ‘,H’ , 15

    2,‘I’ , 10

    3,‘I,’ 5

    4,‘H’ , 5

    5,‘I ‘ , 5

    6,‘H’, 10

    7,‘I’ ,3

    8,‘I’, 3

    9 ,‘I’ , 4

    What I need is to group records by assigning ID base on type "H' type record.Like that:

    ROWNUM,TYPE, AMT, ID

    1‘,H’,15 ,1

    2,‘I’ ,10,1

    3,‘I,’ 5, 1

    4,‘H’ , 5,2

    5,‘I ‘ , 5,2

    6,‘H’, 10,3

    7,‘I’ ,3,3

    8,‘I’, 3 ,3

    9 ,‘I’ , 4 ,3

    Is it possible to do it in SSIS package using like New_ID() but only on "H" type record and pass it to followed "I" type records.

    If not ,I don't mind to do it later using sql (if possible avoiding cursor). Please help. Thanks.Mark

Viewing 0 posts

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