2017-02-09 89 views

回答

3

創建包具有範圍字符串類型的變量。 內部腳本任務,使用值填充該變量。

//get file type and store in variable filetype 

if(filetype == "Excel") 
    Dts.Variables["User::FileType"].Value = "Excel"; 

else if(filetype == "Txt") 
    Dts.Variables["User::FileType"].Value = "Txt"; 

之後,使用基於該變量值的表達式約束來調用適當的數據流任務。

對於Excel數據流的任務,優先constarint將有下面的表達式

@[User::FileType] == "Excel" 

對於文本數據流的任務,優先constarint將有下面的表達式

@[User::FileType] == "Txt" 

Expression and Precedence constraints用於控制包的執行的流程。

+0

嗨,先生,感謝您的寫作,我使用相同的條件,但這兩個表達式評估爲false,並沒有調用任何數據流任務。我應該怎麼做才能使這兩個條件成真 –