Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 How to set a variable value at runtime

Author  Topic 

Bex
Aged Yak Warrior

580 Posts

Posted - 2009-03-10 : 10:23:59
Hi there

Is it possible to set the value of a variable at package runtime?

Thanks

Hearty head pats

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-03-10 : 10:29:35
Yes.
You can read values from a database and assign the value to a variable.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

Bex
Aged Yak Warrior

580 Posts

Posted - 2009-03-10 : 10:49:12
Hi Peso

Thanks for the reply. I didn't really make myself clear..... I have a package which currently does exactly that, it gets a value from a parameter tables in the DB, this is stored in a variable, etc etc. But this value is for testing purposes only. It would be simpler for the user that runs the package from Enterprise manager to be able to set the value when they run the package. (right click package, select run package, select 'replace variable' etc), you can define configurations, etc for the package to use. Can you also assign a value to override a variable?

Thanks

Hearty head pats
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-03-10 : 11:04:05
While building the configuration file ..you can add this variable to the config file. This way, you can change the value of the variable in the config file and execute the package with this new config file.

Hope that makes sense.
Go to Top of Page

Bex
Aged Yak Warrior

580 Posts

Posted - 2009-03-10 : 11:22:48
Hi vijayisonly

That does make sense. i use config files for all connection strings.

The reason I want to set the variable value through the Execute Package Utility is mainly for ease of use purposes. In the event that I am not here to do the work, I would like someone who does not necessarily have great SQL knowledge to be able to execute the package. Therefore, the less prep work they have to do, the better.

But the config route is probably easier to explain and cleaner than inserting the value in a table. So thanks for that idea!

I have seen a Set Values section in the Execute Package Utility......

It says 'specify the properties of package objects to update at run time by providng the path of the package objects and specifying the updated value'

I don't know what this means? Could this be what I am talking about?

Hearty head pats
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-03-10 : 11:34:27
Based on this link..it could be...But I've never used this before...so I dont know for sure..

http://msdn.microsoft.com/en-us/library/ms188978.aspx

You could try this..if it doesn't work, you can post back..and someone will be able to help am sure.
Go to Top of Page

Bex
Aged Yak Warrior

580 Posts

Posted - 2009-03-10 : 12:06:29
That looks liek what I need. I shall have a play, Thanks

Hearty head pats
Go to Top of Page
   

- Advertisement -