Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Lookup Transformation Expand / Collapse
Author
Message
Posted Monday, February 9, 2009 11:45 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, November 12, 2013 7:31 PM
Points: 28, Visits: 194
Hi Friends,

I need to load the data from temp table to target table every month
that should be check for existing data if exist update the data other wise insert new records for every month
I am planning to implement Lookup transformation in SSIS package
please let me know the steps to implement Lookup transformation

Here I am mentioning tables:
Temp Table:
ID OrgID HSTC JRTD LTD Employer EmployerPhoneNo JobTitle PlacementDataEntryStatus



Target Table:
PlacementID IntakeID HSTC JRTD LTD Employer EmployerPhoneNo JobTitle PlacementDataEntryStatus

Here PlacementID is Autogeneratedkey
Post #653082
Posted Monday, February 9, 2009 1:51 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:42 PM
Points: 11,234, Visits: 12,987
If your temp table and your real table are in the same database or on the same server you should use an Execute SQL Task to do this. Your code would be something like this:

Update real_table
Set columns = TT.columns
From
real_table RT Join
temp_table TT On
RT.unique_key = TT.unique_key

Insert Into real_table
Select
columns
From
temp_table TT
Where
Not Exists(Select 1 from real_table RT where TT.unique_key = RT.unique_key)





Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #653208
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse