SSIS - how to set SSIS variable by sql

nononame2021 261 Reputation points
2022-06-16T04:21:35.98+00:00

i need to select some value by sql and then set to SSIS variable, how can i select a row count, some columns from table and then set to SSIS variable?

any sample?

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,703 questions
0 comments No comments
{count} votes

Accepted answer
  1. ZoeHui-MSFT 41,491 Reputation points
    2022-06-16T06:39:59.587+00:00

    Hi @nononame2021 ,

    Please also refer to below link for details.

    https://www.sqlshack.com/execute-sql-tasks-in-ssis-output-parameters-vs-result-sets/

    Regards,

    Zoe


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Olaf Helper 47,441 Reputation points
    2022-06-16T05:18:20.767+00:00

    That's more then simple, with a SQL Task and mapping the the result to a SSIS variable, see
    https://learn.microsoft.com/en-us/sql/integration-services/control-flow/execute-sql-task?view=sql-server-ver16


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.