Ken*_*her 4 sql-server ssis sql-server-2008-r2
我正在尝试使用 SSIS 中的执行 SQL 任务填充变量。表结构如下:
CREATE TABLE BuildControl
(Id INT NOT NULL Identity, BuildDate Date,
Country char(2), BuildStatus varchar(20),
BuildStatusDate DateTime)
Run Code Online (Sandbox Code Playgroud)
SQL 语句是
SELECT TOP 1 ? = Id, ? = BuildDate
FROM BuildControl
WHERE BuildStatus IS NULL
ORDER BY Id
Run Code Online (Sandbox Code Playgroud)
如果我删除? = BuildDate
. 参数映射选项卡如下所示:
我收到的错误是这样的:
SSIS package "WFG Statement Build.dtsx" starting.
Error: 0xC002F210 at Get Build Data, Execute SQL Task: Executing the query "SELECT TOP 1 ? = Id, ? = BuildDate
FROM BuildContr..." failed with the following error: "Error HRESULT E_FAIL has been returned from a call to a COM component.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Get Build Data
Warning: 0x80019002 at WFG Statement Build: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
SSIS package "WFG Statement Build.dtsx" finished: Failure.
Run Code Online (Sandbox Code Playgroud)
我相信问题出在日期输出变量上,因为当我删除它时我没有问题。我使用的服务器和 SSIS 版本都是 SQL Server 2008 R2。连接管理器是使用Native OLE DB\SQL Server Native Client 10.0
提供程序的 OLE DB 连接。我尝试更改表结构以使用 DateTime 没有成功,并尝试在参数映射页面中将 DBDate 和 DBDateTime 作为数据类型也没有成功。
我完全不知所措。谢谢你的帮助!
尝试映射您的结果集,而不是参数。设置类似;在您的选择语句中,结果名称是0
和1
并且? =
不是必需的。
SELECT TOP 1 Id, BuildDate
FROM BuildControl
WHERE BuildStatus IS NULL
ORDER BY Id
Run Code Online (Sandbox Code Playgroud)
此外,请确保您的结果集设置为Single row
。
归档时间: |
|
查看次数: |
5779 次 |
最近记录: |