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 2000 Forums
 SQL Server Development (2000)
 Calculations on Global Variables

Author  Topic 

rohcky
Starting Member

38 Posts

Posted - 2005-04-19 : 16:36:37
Is there a way to perform calculations on a global variable in a DTS? For instance, can I increment the global variable by saying:

SET <var_name> = <var_name> + 1?

I would really appreciate some help.

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2005-04-20 : 05:10:43
Hi
Yeah, you can do it in an ActiveX task:

DTSGlobalVariables("MyVariable").Value = DTSGlobalVariables("MyVariable").Value + 1

Mark
Go to Top of Page

rohcky
Starting Member

38 Posts

Posted - 2005-04-20 : 08:41:18
I tried that, but I get this error message:

>Error Source : Microsoft Data Transformation Services (DTS) Package

>Error Description : Error Code: 0
>Error Source= Microsoft VBScript runtime error
>Error Description: Variable uses an Automation type not supported in VBScript
>Error on Line 6
Go to Top of Page

karuna
Aged Yak Warrior

582 Posts

Posted - 2005-04-20 : 09:17:55
Can you post the specific line which gives error?

Karunakaran
___________
NOTHING IS IMPOSSIBLE, IMPOSSIBLE JUST TAKES LONGER...
Go to Top of Page

rohcky
Starting Member

38 Posts

Posted - 2005-04-20 : 14:34:49
Nevermind, I figured it out.
Go to Top of Page

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2005-04-21 : 06:42:25
What was the problem?

Mark
Go to Top of Page

rohcky
Starting Member

38 Posts

Posted - 2005-04-21 : 13:21:18
I don't remember why I wanted to increment the global variable , but I chose another route, did a select count() and stored it into a global. My problem was creating a loop in a dts and determining when to stop the loop. Set up a loop that stopped when there was no more of a specific value in the table. Thanks for the help though.
Go to Top of Page

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2005-04-22 : 05:01:07
Sounds like a far better approach! Didn't realise you were doing this in a loop.

Mark
Go to Top of Page
   

- Advertisement -