简体   繁体   中英

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

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

I've found that this has helped me with this problem in the past in "Execute SQL Task". 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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM