remove duplicate rows ssis

  • select distinct lastname,fisrstname, titile,cellphoneno , officeno from tableone

    union

    select distinct lastname,fisrstname, titile,cellphoneno , officeno from tabletwo

    then i have a "sort transformation" that order by lastname,fisrstname, titile

    and remove duplicate. after sort transformation i have "lookup" and "drive transformation" and ofcource "OLE DB destination"

    that uses all the coulmn from the source (lastname,fisrstname, titile,cellphoneno , officeno)

    the "sort transformation" is taking forever and degradeding the perfomace of my packages . i was wondering if there is way i can

    remove sort transformation.

  • Is your source SQL Server?

    If it is then you should not have any duplicates in that query as you are returning DISTINCT rows from each part of the UNION operation and the UNION removes any duplicates.

  • Further to Jack's post, the UNION also forces a sort - so you can remove your sort transformation completely and change your query to:

    select lastname, fisrstname, titile, cellphoneno , officeno from tableone

    union

    select lastname,fisrstname, titile, cellphoneno , officeno from tabletwo

    Should speed things up quite a bit.

    PS do you really have a field called 'titile'? 😛


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

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