[英]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.