Temp table and variables

  • EDIT: I think I found the problem. The GO was breaking it.

    Hi, I would like to store some variable in SSIS.

    I've created a couple of variables as int32 and made an Execute SQL Task.

    <code>

    USE database

    CREATE TABLE #temp (col1 int, col2 int)

    INSERT INTO #temp (col1, col2)

    VALUES((SELECT count(*) FROM [database].[dbo].[table1]),

    (SELECT count(*) FROM [database].[dbo].[table2]))

    GO

    SELECT col1, col2 FROM #temp

    </code>

    Then I have for Result Set page:

    col1 User::col1

    col2 User::col2

    It looks right to me but when I run it, I get:

    [Execute SQL Task] Error: An error occurred while assigning a value to variable "col1": "Exception from HRESULT: 0xC0015005".

    I would like it to store the counts from the two tables in the variables so I can later email them.

    Thanks for any help.

  • Hi

    Not sure if this helps in any way last time i had to use variables with ssis i tried temp tables did not go so well so made real table instead which i drop at the end... Try that..

    can you please post the full error message

    Cheers

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply