I want to generate dynamically excel file using SSIS package. I tried like following :
In data flow task I have taken Oledb Source inside oledb source editor
under connection manager taken data access mode = sql command from variable as my variable is having sql query like below select cusip,price,company from mytable where date in between @[var1] and @[var2]
But i failed to use var1 and var 2 it is giving me parse error.
created 3 variables inside ssis project
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
Using above select query I want to generate new excel file every day with filename like MYFile05222013 (with yesterdays date)
var 3 taken as string and added value into Expression
But getting parse error :
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 "@".".
AND
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.
Please advice.
