0

I have assigned a variable in SSIS as BatchID which is Max(ID) from a table. I have passed the BatchID through Result Set in Execute SQL Task (SSIS).Now I can pass that BatchID variable through out the package. My question is how can I change that object datatype to integer or string so I can use differently?

Maverick
  • 1,167
  • 1
  • 8
  • 16

1 Answers1

-1

Yes you can save the result directly to a integer variable: see some more info here:

How do I capture the single row value from Execute SQL Task that uses an expression?

http://technet.microsoft.com/en-us/library/62605b63-d43b-49e8-a863-e154011e6109

Here are some steps for an OLE DB conneciton:

  1. Ensure you have created an SSIS variable of type Int32 or Int64
  2. In your Execute SQL Task, on the General tab, set the ResultSet property to Single row
  3. On the Result Set tab, Add a record with Result Name set to 0, and Variable Name = your integer variable

When you run the step it will populate your variable.

NOTE 1: If you run interactively in BIDS, the variable value doesn't stick. i.e. when you go back into design mode, your variable value goes back to whatever you set it to. But it does work during execution time

NOTE 2: You need to put different values in these fields if using the ADO driver.

Community
  • 1
  • 1
Nick.Mc
  • 18,304
  • 6
  • 61
  • 91