2016-10-10 68 views
0

我有一個員工表與活動和終止員工,我的專欄之一是工作電子郵件。已終止的員工應列出其個人電子郵件,並且活躍員工應列出其工作電子郵件。但是,我從中提取信息的源系統允許活躍的員工更新他們的工作電子郵件。所以我有一些活躍的員工列出他們的個人電子郵件。SSIS - 不允許,如果

對於我而言,我需要的所有在職職工有自己的工作郵箱中列出。在SSIS中,解決我的問題的最佳方法是什麼?

Ex: 
Name  Status Email 
Bob  Act  [email protected] 
Joey  Ter  [email protected] 
Randy  Act  [email protected] 

這裏,因爲蘭迪是積極活躍的員工應該有@ workdomain.com但是,在源系統我把數據從蘭迪改變了他的電子郵件是他個人的結尾的電子郵件。蘭迪的郵件應該是:[email protected]

+0

請與當前的數據和預期的結果共享的樣本數據。 – p2k

+0

@ Pinwar13請參閱編輯 – Joey

+1

爲什麼你不在提取腳本中處理這個問題? – iamdave

回答

0

我會做這樣設置(以避免OLEDB轉型 - 逐行操作)。

裝入數據到2分段表(可以是臨時表):

表#1中。 StageEmp:

Name  Status Email 
Bob  Act  [email protected] 
Joey  Ter  [email protected] 
Randy  Act  [email protected] 

表#2:CorrectEmail

Name  Email 
Randy  [email protected] 

執行SQL任務

Update s 
SET s.email = c.email 
FROM StageEmp s 
Join CorrectEmail c 
ON s.Name = c.Name 
where s.status = 'Act' 
AND s.email not like '%@workdomain.com' 

你應該在的地方Name使用key列。

負載直接StageEmp的實際表或更新的數據的實際的表。

0

據我,你有一個數據流任務下,你有一個Excel源獲取從Excel文件中的數據。你可以這樣做 -

1. Add one "Lookup" component and pass output of "Excel source" to it. 
2. Edit "Lookup" component, and add second source of input to it from your existing table (where you have work email). 
3. Join these two inputs to "Lookup" component on the basis of one of the key columns, 
    so that in output you have two columns one email column from source and one email column from destination. 
3. Add "Derived column" component and pass output of "Lookup" to it. 
4. Edit "Derived Column", add new column and add expression to check whether email column has "@work-domain" or not. 
    If yes, then source email else destination email. 

希望所以我能夠解釋。 enter image description here