Tuesday, March 27, 2012

Getting the count of rows for 3 tables in Single Execute SQL task

hi frnds,

im very new to SSIS package .my package consists of Single Exceute task.

In Single Exceute SQL task i had 3 seperate queries to get the count of rows of 3 tables.

the Query goes like dis ...

select count(*) AS precheckcount1 from new_main_dts where cust_nbr like '875%'

like dis for another 2 tables i had written with the alias name precheckcount2 and 3

i mapped the variable user::precheckcount1 to precheckcount1 in the resultSet and for other two alias name i did the same.

while executing the package the error is thrown : [Execute SQL Task] Error: An error occurred while assigning a value to variable "precheckcount2": "Unable to find column precheckcount2 in the result set.".

please help me its very urgent

It is simplest if you get all values in a single result set. Set the ResultSet property to single row, then use a query like this to get the combined result sets-

SELECT (SELECT COUNT(*) FROM sysobjects) AS C1, (SELECT COUNT(*) FROM sysobjects WHERE type = 'U') AS C2

Then on the Result Set tab set the mappings using the column indexes, Result Name of 0 maps to the variable name for the first column's value. Result Name 1 maps to the variable name for the second column's value.

|||

thanks a lot.

my problem got resolved.

No comments:

Post a Comment