IN SSIS 2008 I HAVE THE LAST ROW

  • Hello everybody,

    I have a question on SSIS 2008:

    Here is an example:

    I have a table with two columns:

    Identifier customer Version

    5 1

    5 2

    5 3

    I want to load in the target table the third line: 5 (Identifier customer) 3 (Version).

    Do you know how to do?

    Thanks a lot for your answers.

  • Probably not the best method, but you could use SSIS to import the data into a "Staging Table" and then execute a T-SQL statement to do what you want to do. For example

    CREATE TABLE #Temp(Identifier_customer INT, [Version] INT)

    INSERT INTO #Temp

    SELECT 5, 1 UNION ALL

    SELECT 5, 2 UNION ALL

    SELECT 5, 3 UNION ALL

    SELECT 6, 0 UNION ALL

    SELECT 7, 2

    SELECT Identifier_customer,MAX([Version]) FROM #Temp GROUP BY Identifier_customer

    Result:

    Identifier_customer(No column name)

    5 3

    6 0

    7 2

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Thanks a lot Ron but I want to use only SSIS transformation.

    Would you have an idea?

    Thanks

  • Unfortunately I am not a fan of SSIS, the only further assistance I can suggest is to read the "Starways" articles for SSIS

    http://www.sqlservercentral.com/stairway/72494/

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Thanks a lot Ron.

    I don't find the answer to my issue.

    It seems complicated.:(

  • ilan_2610 (2/26/2012)


    Thanks a lot Ron.

    I don't find the answer to my issue.

    It seems complicated.:(

    By what logic do you want that last row.

    Is it always the last row, or the one with the maximum version, as Bitbucket suggested?

    If it's the max, use the aggregate transform.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 6 posts - 1 through 6 (of 6 total)

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