Saturday, February 25, 2012

Conditional Data Inserting

Hello,

My project import data from à text file to a database. I'm able to import the whole file but i want to import only if data are younger than the one i have in database.

How can i do ? Where can i see a tutorial about it ?

thanks a lotDo both the source rows and the database rows have a date that can be compared. If so then you could use either a lookup or a mergejoin to get the two dates into the same data flow (by lookup or join on some key that indicates the rows are matched) and then use a conditional split to send the rows you want to update to a OLEDB command transform with the appropriate update statement (or if you do indeed want to insert the data not update then just send it to an OLEDB destination).

Thanks,
Matt|||There's a tutorial here that compares merge join and lookup components. Its not exactly the same as your situation but it may help!!

-Jamie|||Thanks it is very useful !

But i'm still blocked because in some case i need to insert, and in other case i need to update...|||Ash has a great post on upserts here:
http://sqljunkies.com/WebLog/ashvinis/archive/2005/06/15/15829.aspx
Give that a shot.
Thanks,

No comments:

Post a Comment