So here we have an error I keep getting in my SSIS package but I can't see what is wrong with the statement. I have even tried another sql statement from a project that works and it still raises the error.
The system is VS 2005 running 64 bit debugger, on XP machine. The project has amongst other things a script task then a sql task, the script task outputs the month value to a variable (Dts.Variables("monthName").Value = month), which I then use to create dynamic table name in SQL statement. I haven't got to the excel sheet bit yet as I am trying to get the sql task stage working.
So i have a variable at package level called SQLTableCreate, and in that I have the properties set to:
- Evaluate as Expression = true
- Expression = "Create Table "+ @[user::monthName]+"(
Column1
DATETIME,Column2
NVARCHAR(255),Column3
NVARCHAR(255),Column4
NVARCHAR(255),Column5
NVARCHAR(255),Column6
NVARCHAR(255),Column7
NVARCHAR(255),Column8
NVARCHAR(255),Column9
NVARCHAR(255),Column10
NVARCHAR(255))"
And when I build the package I get:
Nonfatal errors occurred while saving the package: Error at Package: The variable "user::monthName" was not found in the Variables collection. The variable might not exist in the correct scope. Error at Package: Attempt to parse the expression ""Create Table "+ @[user::MonthName]+"(
Column1
DATETIME,Column2
NVARCHAR(255),Column3
NVARCHAR(255),Column4
NVARCHAR(255),Column5
NVARCHAR(255),Column6
NVARCHAR(255),Column7
NVARCHAR(255),Column8
NVARCHAR(255),Column9
NVARCHAR(255),Column10
NVARCHAR(255))" " failed and returned error code 0xC00470A6. The expression cannot be parsed. It might contain invalid elements or it might not be well-formed. There may also be an out-of-memory error.Error at Package: The expression for variable "SQLTableCreate" failed evaluation. There was an error in the expression.
There is also a default SQL statement for the variable SQLTableCreate, which uses the current excel connection manager table name. When I put my dynamic statement in the expression section of properties it fills the value and valuetype property of the SQLTableCreate variable with the message:
The expression for variable "SQLTableCreate" failed evaluation. There was an error in the expression.