[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 615
  • Last Modified:

My value for a Variable I load from an SSIS Task Resultset goes to -1

I have a simple Select Statement that returns a single row. I am trying to read that value into a Package Level Variable and then use that variable in the next step.

Each time I run the package, I get the value -1 returned. Details of what I am trying to do is as follows:
SQL Statement: Select (Max(LoadNumber) + 1) As LoadNumber From TableName

Variable Name: User::LoadNumber, Datatype Int32

Execute SQL Task Details:
- ResultSet: SingleRow
- ConnectionType: OLEDB
On the Result Set Tab:
- ResultName: LoadNumber
- Variable Name: User::LoadNumber

I have a Script Task after this task to show a Messagebox with the value of the Variable and it shows -1

When I run the statement in a Query window, it shows the correct value.

Does anyone know why I could be getting -1? Seems like some type of returncode to me but I can't find from what?
  • 2
1 Solution
What is the SingleRow Result Set datatype set to? LONG?
QCentricAuthor Commented:
I can't find the property for the SingleRow Result Set dataypte.

The ForcedExecutionValueType is Int32
The Value returned in the Select Statement is Int
The User Variable is Int32
QCentricAuthor Commented:
I decided to change the return value from Int32 to String and I can now read the value fine.

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now