Error at Data Flow Task [OLE DB Source [1]]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. 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: "Argument data type datetime2 is invalid for argument 2 of dateadd function.".
I have the following query which as you can see has two parameters for the day of DateAdd. In the parameters I have entered variables for the parameters that are Int32 type variables. I get the above error. This is for a OLE DB Source Editor in SSIS for Visual Studio 2008. The query works fine in SQL. Is there a work around or solution for this? Also I have explored construction of the entire dateadd for a variable in a script task and then adding these as parameters but this creates another error in the source editor.
SELECT o.Id,o.UniqueId,o.ClientId,bt.Name as BaseType,ot.Description as ObjectType,ost.Description as ObjectSubType,o.Status,o.Number,o.Name,o.Owner,o.ObjectGeom,o.ObjectMBRGeog,o.Is Active,o.CreateDate,o.UpdateDate
FROM Client.dbo.Objects o INNER JOIN Client.dbo.BaseTypes bt ON o.BaseTYpeId = bt.Id
INNER JOIN Client.dbo.ObjectTypes ot on o.ObjectTypeId = ot.Id
LEFT OUTER JOIN Client.dbo.ObjectSubTypes ost on o.ObjectSubTypeId = ost.Id
WHERE o.UpdateDate > DateAdd(day, ?, sysdatetime()) or (
o.UpdateDate is null and o.CreateDate > DateAdd(day, ?, sysdatetime()))
ORDER BY o.Id
User contributions licensed under CC BY-SA 3.0