参数数据类型datetime2对于SSIS Visual Studio 2008

时间:2016-04-26 03:23:45

标签: sql-server visual-studio-2008 ssis

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.".

我有以下查询,您可以看到DateAdd当天有两个参数。在参数中,我输入了Int32类型变量参数的变量。我得到了上述错误。这是针对Visual Studio 2008的SSIS中的OLE DB源编辑器。该查询在SQL中工作正常。是否有解决方法或解决方案?我还研究了在脚本任务中为变量构造整个dateadd,然后将它们作为参数添加,但这会在源代码编辑器中创建另一个错误。

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

0 个答案:

没有答案