Search code examples
sql-server-2008ssisoledb

SSIS can't use variables (Flat File > OLE DB Command), Must declare the scalar variable "@"


Apologies, I'm an SSIS noob and I'm struggling with trying to import a flat file and do an OLE DB command WHILE including a variable in the SqlCommand.

Data Flow

You can see my query and the attempt to include an already defined variable. The error is displayed below:

Advanced Editor for OLE DB Command

Must declare the scalar variable "@" I understand what the error is saying, but after hours of searching, I cannot figure out how to use variable in the OLE DB Command.

Thanks in advance for any assistance.


Solution

  • Try putting the ssis variable [user::ClientID] into a derived column and add it to the data flow. You should be able to use a ? and assign that value to your query just like any other value in your data flow.