Showing posts with label variable. Show all posts
Showing posts with label variable. Show all posts

Thursday, March 22, 2012

Can't Set variable Through Command Line

Hello everyone!

Bit of a problem executing a DTS command from a command line.

I have the following variables defined in my package:

UserVarchar1
UserVarchar2
UserVarchar3

All have a scope of Package, all of the mstrings

The command I'm attempting to run in 1 line is:

DTEXEC /FILE "C:\SSIS Packages\ED-Customers\Package.dtsx"
/SET \Package.Variables[User::UserVarchar1].value;"10"
/SET \Package.Variables[User::UserVarchar2].value;"30719"
/SET \Package.Variables[User::UserVarchar3].value;"BILLTO"

Description: The package path referenced an object that cannot be found: "\Package.Variables[User::UserVarchar1].value". This occurs when an attempt is made to resolve a package path to an object that cannot be found.

DTExec: Could not set \Package.Variables[User::UserVarchar1].value value to 10.

Any idea why?

Thanks for the help!What happens if you try:

\Package.Variables[User::UserVarchar1].Properties[Value];10|||For some reference:
http://blogs.conchango.com/jamiethomson/archive/2007/03/13/SSIS_3A00_-Property-Paths-syntax.aspx|||

How are you validating the path?

Check the path and remember the variables names are case sensitives.

|||

The syntax is wrong.

Check Phil's posts above.

-Jamie

|||I tried that.. Still says it can't assign it the value of 10.

It's case-accurate, in both path and variable names.

Description: The package path referenced an object that cannot be found: "\Package.Variables[User::UserVarchar1].value". This occurs when an attempt is made to resolve a package path to an object that cannot be found.

DTExec: Could not set \Package.Variables[User::UserVarchar1].value value to 10.

Is there something I'm missing in the design of the package, perhaps? All I did was add the variables to the package. Another variable uses these values and evaluates it as an expression. Doesn't seem too complex, yet I'm still miffed about why this won't execute.

Incidently, if I run the package WITHOUT variables, it will in fact run successfully.|||Adam, make sure the scope of that variable is at the package level, not some other component.|||By any chance is the ReadOnly property of the variable set to True? I get the same error if the value is true; if you want ot assign values at run time it should be set to false|||Thanks for the input, everyone! I finally figured it out.

The first reply was correct. I didn't notice .Properties[Value] in the first reply. Don't know how I missed it.

Sorry, it's been one fo those mornings..

Thanks again, everyone!

Wednesday, March 7, 2012

cant print variable

Hi,
In the query analyser if I type the following:

DECLARE @.SortOrder integer
exec pr_Admin_SetFieldSortOrder @.SortOrder
print @.SortOrder

@.SortOrder is never printed. I just get the message saying that the
Query Batch Completed.

Why ?

RegardsI guess @.SortOrder is an output parameter? If so, you need to add
OUTPUT:

exec pr_Admin_SetFieldSortOrder @.SortOrder OUTPUT

Simon|||cool
thx

Sunday, February 12, 2012

Can't I dynamically read from any file? - Connection Manager does not exist

I have a Parent package and a child package.

I have hard coded the value for the User::FilePath variable in the parent package.

I am mapping this variable to the value of the same variable in the Child Package.

I created a directory and sql file: "C:\temp\sqlb.sql". I have verified that the path variable value is passed to the child package by using a Script task with a messgbox call.

How do I define an execute sql task to execute sql file: @.[User::FilePath] & "sqlb.sql". I'm using this expression for the SqlStatementSource property. I have entered the OLEDB server information and specified the SQLSourceType = fileconnection.

However I get the error:

[Execute SQL Task] Error: Connection manager "D:\rlewisdev\ZZ\sqlb.sql" does not exist.

What am I doing wrong?

SQLStatementSource in this case points to a connection manager, not a file. You'll have to build a connection manager, call it "SQLFile" or something and use that as the SQLStatementSource. Then you'll have to change the ConnectionString of the connection manager named "SQLFile" (or whatever you decide to call it.)|||

Hi boston..,

You have to create a connection manager based on file path,

you can do the following steps:

1-create connection manager myfilepath

2-right click on this connection and click properties

3-in properties click on the button ... behind expression property

4-In property expression editor ,select the connection string property, and click button ... in the right column

5-In expression builder window expand the variable tree and select ur path variable and drag it to the expression container.

6-click on evaluate expression

NB: you can save your configuration setting in xml file or regsitry or sql server from "package configuration wizard".

Thanks,

Tarek Ghazali

SQL Server MVP

http://www.sqlmvp.com