我想使用 SSIS 包动态生成 excel 文件。我试过如下:
在data flow task
我采取了
以下措施Oledb Source
,因为我的变量具有如下所示的 sql 查询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.
请指教。