Checking to see if a record exists else insert
I am checking to see if the source record is available in the target table using a lookup transformation and if not found i have to insert this record.
I have connected the error flow of the lookup transformation to the target. I am acheiving expected results, but is this the best practise? I have not connected to the green arrow to any task.
April 30th, 2008 11:22am

Robin Wesley wrote:
I am checking to see if the source record is available in the target table using a lookup transformation and if not found i have to insert this record.
I have connected the error flow of the lookup transformation to the target. I am acheiving expected results, but is this the best practise? I have not connected to the green arrow to any task.

how to do upserts: http://www.sqljunkies.com/WebLog/ashvinis/archive/2005/06/15/15829.aspx

hth

Free Windows Admin Tool Kit Click here and download it now
April 30th, 2008 11:52am

Thanks Duane. But i am not doing any update all i want to do is, lookup- if no matchfound then insert else ignore. I am worriedmoreso becausei am doing it through the error flow and want to know if there is any better way to do this.

May 2nd, 2008 7:52am

Robin Wesley wrote:

Thanks Duane. But i am not doing any update all i want to do is, lookup- if no matchfound then insert else ignore. I am worriedmoreso becausei am doing it through the error flow and want to know if there is any better way to do this.

handling lookup misses: http://blogs.msdn.com/ashvinis/archive/2005/08/04/447859.aspx

hth

Free Windows Admin Tool Kit Click here and download it now
May 2nd, 2008 8:18am

Hi, I got this problems when i tried to run package : insert if new and update if exists to separate database (New record and change record) . Both updating records and new record were updated to database (new record ), instead of 1 to change record and 1 to new record . My conditions  :

  1. New records : Isnull (App_ID) != Isnull (Lkp.App_ID)
  2. Change records : (Is null (App_ID) == Isnull(Lkp.App_ID)) && (Isnull(Customer_name) != Isnull(Lkp.Customer_name) || Isnull(CPC_Center) != Isnull(Lkp.CPC_Center))

Pls help me to slove it .

Many thanks,

Hong


January 14th, 2014 5:08am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics