SSIS --The expression was evaluated, but cannot be set on the property - ssis

I have package that I have been testing for the last 8 months. Today when I deployed the package on the client machine, it gave the following error:
MainContainer:Error: The result of the expression
"#[$Project::FilePath]+ #[System::PackageName]+".xml"" on property
"\Package.Properties[CheckpointFileName]" cannot be written to the
property. The expression was evaluated, but cannot be set on the
property.
#[$Project::FilePath] contains the file path. In this case the value is: C:\Verfication_Reports\
#[System::PackageName]:MainContainer
The package executes successfully but it generates the above error in the SSISDB. This property contains the path of checkpoint file. Please help.

a bit late, but anyway.
make sure the path also exists in the client's file system.

Related

Data Flow Task - Set two User Date Variables as Parameters

I am creating an SSIS package that will run each month. This particular stored procedure needs to run for one week at a time since the data returned is very large.
I have set up my stored procedure to with two parameters: #StartDT and #EndDT. I created two SSIS variables: StartDT and Wk1EndDT (I'll create the other start and end dates for the weeks once I get this one working).
StartDT has this expression:
(DT_DATE)((DT_WSTR, 4)YEAR(DATEADD("mm", -1, GETDATE())) + "-" +RIGHT("0" + (DT_WSTR,2)MONTH(DATEADD("mm", -1, GETDATE())),2)+"-01")
Wk1EndDT has this expression:
DATEADD("DD",7, #[User::StartDT])
I'm using a DataFlow task with a SQL command text of:
EXECUTE dbo.uspUploadWk1 ?,?
When I go to preview the results, I receive the following error message:
There was an error displaying the preview.
No value given for one or more required parameters. (Microsoft SQL Server Native Client 11.0)
I have the parameters set like this:
I am not sure why this isn't working. I've searched all over and have not found an answer. I am using Visual Studio 2015.
Assuming an OLE DB Connection Manager, the Mappings tab should be using a zero based ordinal system on the Parameters column. Yes, it defaults to naming them as Parameter0, Parameter1, etc but for an OLE DB connection manager, you'll use the ordinal position of the question marks, ?, starting at zero.
For ODBC, it becomes a 1 based counting but still uses ? as the parameter place holder.
ADO.NET uses named parameters so we'd match EXECUTE dbo.uspUploadWk1 #Parameter0, #Parameter1 but the ADO.NET source component doesn't support parameterization
Reference on parameters and mapping for Execute SQL Task but the syntax remains the same for Data Flow Task components

Access error when saving query

I am trying to save an Access query with the following statement.
INSERT INTO FOO( DES_MOTIVO, DES_TIPO, DES_SUBTIPO,
AGRUPACIÓN, SEMANA, CuentaDeCOD_ACCION_CLIENTE )
IN 'C:\Users\BAR\Desktop\03. Hola\DB STATIC INTERACCIONES MES.accdb'
I am getting an error when saving the query, saying the path is incorrect. Testing the path, i found out that the culprit is the period+whitespace in "03. Hola". Deleting the whitespace fixed the issue and the query saves properly.
Is there a way to escape the period so that access accepts the save path with period + whitespace?
Thank you in advance,
Nega.
Apparently this is not possible with SQL or VBA code.
Fun fact: You can do it in the query designer by setting the Destination database setting of the query properties. Set your path, the query can be saved and executed (and it works!).
But switch to SQL view and try to save: you get the "invalid bracketing" error. Same when trying to set the SQL from VBA.
And the DestinationDB property that the help file mentions isn't available via code. It seems to be derived from the IN clause.
So your database will have to moved to a better path. Or, if it's single user, copy to temp path, run the INSERT, copy back.
See also: https://support.microsoft.com/en-us/kb/132184
Try adding quotes around the path:
"INSERT INTO FOO( DES_MOTIVO, DES_TIPO, DES_SUBTIPO, AGRUPACIÓN, SEMANA, CuentaDeCOD_ACCION_CLIENTE ) IN '""C:\Users\BAR\Desktop\03. Hola\DB STATIC INTERACCIONES MES.accdb""'"
But why do you maintain such weird folder names as "03. Hola"?
Indeed on the Desktop, you should be able to create a simpler folder name.

Spaces in the connection string value of an SSIS CommandFile variable value

I am pretty new to SSIS (my first real project) and I have built a package that successfully performs some insert operations on a database. I want to deploy it to multiple environments, so I have created a connection manager whose connection string will be passed in from the command line which will in turn be defined in a command file.
The command that I run from the command line is ...
DTExec /F InitialDatabseImport.dtsx /CommandFile InitialCommandFile.config.txt
In the command file (InitialCommandFile.config.txt) I have the following variable assignment ...
/SET \Package.Variables[User::DBConnectionString].Properties[Value];"\"Data Source=(localdb)\ProjectsV12;Initial Catalog=DatabaseName;Integrated Security=SSPI;Connect Timeout=30;Auto Translate=False;"\"
Running this I get the following error ...
Option "Source=(localdb)\ProjectsV12;Initial" is not valid.
It seems that is delimiting the connection string on spaces rather than semicolons.
I have tried a number of configurations with quotes. Here I changed the quotes in front of "Data" to something that seemed to make more sense ...
/SET \Package.Variables[User::DBConnectionString].Properties[Value];\""Data Source=(localdb)\ProjectsV12;Initial Catalog=MarketingPrefsDB;Integrated Security=SSPI;Connect Timeout=30;Auto Translate=False;"\"
which returned the error ...
The argument "\Package.Variables[User::DBConnectionString].Properties[Value];\"Data" has mismatched quotes.
And this one, I wrapped the entire assignment in quotes ...
/SET "\Package.Variables[User::DBConnectionString].Properties[Value];\"Data Source=(localdb)\ProjectsV12;Initial Catalog=MarketingPrefsDB;Integrated Security=SSPI;Connect Timeout=30;Auto Translate=False;\"";
which returned the error ...
Argument ""\Package.Variables[User::DBConnectionString].Properties[Value];\"Data" for option "set" is not valid.
Has anyone else who has seen this problem been able to figure it out?
Thanks,
G
UPDATE - 2014/07/21
When I put the SET command directly in the command line I am getting a slightly different error ...
Command Line ...
C:\Project>DTExec /F QuaeroInitialImport.dtsx /SET \Package.Variables[User::DBConn
ectionString].Properties[Value];"Data Source=servername;Initial Catalog=DatabaseName;Integrated Security=SSPI;Connect Timeout=30;Auto Translate=False;"
Error Message
Argument ""\Package.Variables[User::DBConnectionString].Properties[Value];\"Data Source=servername;Initial Catalog=DatabaseName;Integrated Security=SSPI;Connect Timeout=30;Auto Translate=False;" for option "set" is not valid.
I've met similar issue and just share my work-around in case others reach here thru google.
My case is:
Deploying the package on SQL Server 2014, and I use some package parameter in the package and met this issue. I've met this if I don't use package parameter on another server running SQL Server 2014 also (both server are running the same version of SQL Server 2014).
I fix this by replacing all spaces in the keywords of the connection space with an underscore (_). The connection work for me on my server like:
Data_Source=xxx.xxx.xxx.xxx,xxxx;Initial_Catalog=ABC_DEF;Provider=SQLNCLI11.1;Persist_Security Info=True;Auto_Translate=False;User_ID=userabc;
Please note even I have forgotten to replace some space in some keyword, it still works.
So I finally change it as below:
Data_Source=xxx.xxx.xxx.xxx,xxxx;Initial_Catalog=ABC_DEF;Provider=SQLNCLI11.1;Persist_Security_Info=True;Auto_Translate=False;User_ID=userabc;
So... it doesn't make me comfortable in this case as I am not sure actually if it is working on a correcting settings... you still have to verify it yourself.

Variable scope in SSIS config table

I'm trying to change the scope of some of my variables in my SSIS package. They rely on a config table in a database, and previously they got their values set with the following values in the database:
\Package.Variables[User::EmailAddress].Properties[Value]
And the value for that would be set in the ConfigurationValue column.
This worked like a charm, except once I changed the scope of the variable from package to a specific foreach loop container, I've gotten the following error:
Warning: The package path referenced an object that cannot be found: "\Package.Variables[User::EmailAddress].Properties[Value]". This occurs when an attempt is made to resolve a package path to an object that cannot be found.
The other, globally-scoped variables don't have this problem. Is there some value in this string that's telling SSIS to look at the package level, instead of in the entire package?
You can go one of two ways - either rebuild the DTSConfig using the wizard, or alter the path in file to include the ForEach Loop
\Package\ForEachLoopName.Variables[User::EmailAddress].Properties[Value]

SSIS The expression for variable 'Variable' failed evaluation. There was an error in the expression

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.
It's exactly as the error says
The variable "user::monthName" was not found in the Variables collection
Things in SSIS are case sensitive and Variables are one of those things. Make your 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))"
Also, I hope this table design is just a sample and not real. Lack of column names and strong data types is technical debt you don't need to incur at this stage.