Return Integer value from SSIS execute SQL Task

纵然是瞬间 提交于 2019-12-13 12:28:09

问题


I am using SQL Server 2005 Business Intelligence Studio and struggling with returning an integer value from a very simple execute SQL Task. For a very simple test, I wrote the SQL Statement as:

Select 35 As 'TotalRecords'

Then, I specified ResultSet as

ResultName = TotalRecords and
VariableName = User::TotalRecords

When I execute this, the statement is executed but the variable doesn't have the updated value. However, it has the default value that I specified while variable definition.

The return of a date variable works, but integer variable isn't working. The type of User::TotalRecords specified is Int32 in a package scope.

Thanks for any hints


回答1:


The value for Result Name is incorrect. Try using an ordinal (position) based approach.

A basic set up for an OLE or ADO.NET Execute SQL Task

Here I have specified the ordinal of 0 for the zeroeth column in my resultset.

Here you can see the original variables and their values (-1, -2) as well as their run-time values of 35 for both.




回答2:


Once your package completes yuor variables go back to their default state. If you use a breakpoint or a msgbox, you'll see that during execution your variable does have the value.



来源:https://stackoverflow.com/questions/12565964/return-integer-value-from-ssis-execute-sql-task

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!