SSIS パッケージを使用して動的に Excel ファイルを生成したい。私は次のように試しました:
私の変数は以下のようなSQLクエリを持っているので、私は中を
取りdata flow task
ましたOledb Source
oledb source editor
connection manager
data access mode = sql command from variable
select cusip,price,company from mytable where date in between @[var1] and @[var2]
しかし、私は使用var1
に失敗し、var 2
解析エラーが発生しています。
ssis プロジェクト内に 3 つの変数を作成しました
var1 datatype = datetime value=5/01/2011 8:22:10 AM
var2 datatype = datetime value=5/21/2011 8:22:10 AM
var3 datatype = datetime value=MY ABOVE SELECT QUERY
上記の選択クエリを使用して、次のようなファイル名で毎日新しいExcelファイルを生成したいMYFile05222013
(with yesterdays date)
var 3 taken as string and added value into Expression
しかし、解析エラーが発生します:
Error code: 0x80040E14.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E14 Description: "Statement(s) could not be prepared.".
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E14 Description: "Must declare the scalar variable "@".".
と
The data types "DT_WSTR" and "DT_DATE" are incompatible for binary operator "+". The operand types could not be implicitly cast into compatible types for the operation. To perform this operation, one or both operands need to be explicitly cast with a cast operator.
ご意見をお聞かせください。