0

I need to do a loop over comany names using ssis What I did

  • Declare a SSIS variable of Object type.
  • Through a SQL task execute a query ("select distinct Name from dbo.company") & - fill you variable in result set.
  • Apply a For Each Loop.
  • In the collection tab of loop -> Select Enumerator as "ForEach ADO Enumerator"
  • Select your variable in the ADO object source
  • Set the Enumeration mode as "Rows in First table"

I add a variable varcompany with expression

"SELECT * FROM dbo.[" + (DT_STR) @[User::VarCompanyName] + "$Agents de recouvrements]"'

Then I choose data access mode Sql command from variable varcompany But it doesn't work I got the following error :

Description: "Incorrect syntax to '+'. '.

How to correct it ?

  • Are you trying to use the original Object Type variable in the expression? or are you mapping the outcome of the For Each Loop to another string variable? If you are mapping it to a different string variable, then remove the DT_STR. – Peter_R May 11 '15 at 13:10
  • Does varcompany have the property `EvaluateAsExpression` set to `true`? – billinkc May 11 '15 at 15:43
  • Set a watch on varcompany and watch it in the debugger. are you getting the values you expect when it comes to trying to execute it in your dataflow? – Tab Alleman May 11 '15 at 16:01
  • 1
    Also, you can't put the expression there. The OLE DB Destination for Sql Command data access mode doesn't do that. Instead, you need to create a Variable, of type String, which has as the Expression `"[dbo.]" + @[User::VarCompanyName] + "$Agents de recouvrements]"` – billinkc May 11 '15 at 16:42
  • I'm seeing a stray single quote at the end of your expression. – Mike Honey May 13 '15 at 04:26

0 Answers0