• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

activex script in DTS

Hello,

How would I create a counter in an activex script.

For instance I would like to have a variable called counter and increment it.

Dim counter= 0

DTSDestination("fielda")= counter + 1

What I get now is the all records have a 1 instead of incremented value.


I would like fielda to contain the new value for each row read.

thanks in advance,

Don

0
dprice7
Asked:
dprice7
2 Solutions
 
Anthony PerkinsCommented:
In order to do that you will need to define a global variable, set its initial value (see the Package Properties) and change your ActiveX Script as follows:

DTSGlobalVariables("YourCounterNameGoesHere").Value = DTSGlobalVariables("YourCounterNameGoesHere").Value + 1
DTSDestination("fielda") = DTSGlobalVariables("YourCounterNameGoesHere").Value
0
 
graf0Commented:
You would have to use the global variable (i.e. declared on a DTS package level) in your ActiveX script. Otherwise the locally declared variable is initalised for each row read (as the ActiveX script is stateless and called separatelly for each row).
0
 
nmcdermaidCommented:
If you're interested there may be a way to do this without code using an IDENTITY field.
0
 
dprice7Author Commented:
I want to split the points so I can split them.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now