简体   繁体   English

执行sql任务结果集

[英]Execute sql task result set

I am trying to count number of rows我正在尝试计算行数

SELECT COUNT(*) count
FROM table
group by col1,col2

and assign this to result set in execute sql task but am getting an error并将其分配给执行 sql 任务中的结果集,但出现错误

[Execute SQL Task] Error: An error occurred while assigning a value to variable "numberofrowstoerror": "Single Row result set is specified, but no rows were returned.". [执行 SQL 任务] 错误:为变量“numberofrowstoerror”赋值时出错:“指定了单行结果集,但没有返回任何行。”。

I've found that this has helped me with this problem in the past in "Execute SQL Task".我发现这在过去的“执行 SQL 任务”中帮助我解决了这个问题。 If an SQL Task Editor expects results returned in a row … but there are no records to return then the following SQL fills a null return with a space.如果 SQL 任务编辑器期望在一行中返回结果……但没有要返回的记录,则以下 SQL 用空格填充空返回。 Note : can also be used to return zero if a numeric “return row” is expected注意:如果需要数字“返回行”,也可用于返回零

SELECT '' + ISNULL ((SELECT field FROM table WHERE (key = ?)), '') AS field

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 返回执行SQL任务的单行单值结果集,作为对SSIS中另一个执行SQL任务的输入 - Return single row single value result set of Execute SQL task as an input to another execute SQL task in SSIS 执行SQL任务-全部结果集数据类型不匹配错误 - Execute SQL Task -Full Result Set Datatype Mismatch Error SSIS 2012截断执行SQL任务的结果集 - SSIS 2012 truncates result set of Execute SQL task 执行SQL任务(SSIS),然后将结果集插入其他服务器上的表中 - Execute SQL task (SSIS) and then insert the result set into a table on a different server 将结果存储在执行 Sql 任务中 - Store result in Execute Sql task 如何使用约束编辑器中的查询结果集来有条件地执行SQ​​L任务? - How to use the Result Set from a Query in the Constraint Editor to conditionally execute SQL Task? 单行结果集导致SSIS SQL执行任务错误但没有返回行 - SSIS SQL Execute task error caused by single row result set but no rows were returned 我们可以给多少个执行sql任务的结果测试 - how many result test we can give a for execute sql task SSIS - 如何将“执行SQL任务”的Recordset转换为List <string> - SSIS - how to transform a Recordset as a result of an “Execute SQL Task” into a List<string> 执行SQL任务失败 - Execute SQL Task Failing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM