SSIS Lookup 找不到匹配數據

 

用戶有一個需要用txt更新表數據的功能,用lookup實現,步驟:

 

  1. 循環文件夾的txt文件

  2. Lookup 全部cache目標表數據,比對txt數據和目標表數據

 

wKioL1Ph7J2DkGcKAAF0OO3-dD0548.jpg

3. 如果有match的數據用txt更新目標表

 wKioL1Ph7SiRRRp6AACpyH_8kJ8464.jpg

但是執行每次Match的數據都是0,而txt中確實存在匹配的數據。翻了一下微軟的BOL,有一句話很重要:

If there are multiple matches in thereference table, the Lookup transformation returns only the first matchreturned by the lookup query. If multiple matches are found, the Lookup transformation generates anerror or warning only when the transformation has been configured to load allthe reference dataset into the cache. In this case, the Lookuptransformation generates a warning when the transformation detects multiplematches as the transformation fills the cache.

 

後來查了一下我的記錄中確實記錄都是重複,由於我選擇了處理錯誤的方式“Redirect rows to no match output”,所以數據都到了Not match.

 

之後嘗試將重複數據刪除就正常了。因爲考慮到大部分應用是數據倉庫方面的,維度都是爲一的,所以很少碰到這個問題。

 

還有一點要注意的是Lookup是大小寫敏感的,在處理帶有字符數據的時候要注意。

 

另外這個功能用上次提到的處理緩慢變化維的組件也可以實現。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章