簡體   English   中英

查詢以使用變量過濾ODBC Source SSIS中的數據

[英]Query to filter the data in ODBC Source SSIS using variable

我正在ODBC源中編寫源查詢,以過濾列(nvarchar)上的記錄以提取增量負載。

在SouceCodeExpression中,我編寫了以下代碼。

“從Source_AuthorizationHistory中選擇*,其中UpdateDate>” +“'@ [User :: LastUpdate]'”

這里UpdateDate是來自源的nvarchar數據類型,我必須根據目標中的最后更新日期來過濾來自源的記錄。 因此,這里@ [User :: LastUpdate]變量數據類型為String

@ [User :: LastUpdate] =從Target_AUTHORIZATIONHISTORY中選擇Convert(nvarchar,Cast((Max(ETL_updated)-1)作為Date))作為最后更新

幫我寫這個源查詢表達式

“從Source_AuthorizationHistory中選擇*,其中UpdateDate>” +“'@ [User :: LastUpdate]'”

我收到以下錯誤ErrorCode

假設您對@[User::LastUpdate]值正確

你有這個:

"Select * from Source_AuthorizationHistory where UpdateDate >" + "'@[User::LastUpdate]'"

您需要這樣做:

"Select * from Source_AuthorizationHistory where UpdateDate > (" +  @[User::LastUpdate] + ")"

因為此表達式將等於:

Select * from Source_AuthorizationHistory where UpdateDate > (Select Convert(nvarchar,Cast((Max(ETL_updated)-1) as Date)) as LastUpdated from Target_AUTHORIZATIONHISTORY)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM