![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi all -- I'm trying to write my own ActiveX transformation script to copy some fields from an old table using a couple different data types to a new table. I seem to be having problems with the different data types and can't get DTS to run with them. I'm sure it's just due to my in-experience with DTS. Here is a sample of the code: '************************************************* ********************* ' Visual Basic Transformation Script '************************************************* *********************** ' Copy each source column to the destination column Function Main() Dim PercentUp DTSDestination("ProcessDate") = DTSSource("Date") ' this line works DTSDestination("DB") = DTSSource("DB") ' this line works DTSDestination("ExpectedMinsUp") = DTSSource("PotentialUptime") ' this line works DTSDestination("MinsDown") = DTSSource("TotaldowntimeMin") ' this line works ' this line fails DTSDestination("PercentDown") =CINT(( DTSSource("TotalDowntimePrc")) * 100) * 100 The source datatype is Decimal(5,4) and the destination is a integer. Essentially, I want to multiple the source by 100 twice to get the percentage value. Then I want to store the result in the destination. For example, the source may be .2807 and I want to multiple it by 100 to return 28.07 then by 100 again to return the integer vale of 2807. Once the value is 2807, my SQL queries that pull the value will divid by 100 to get the percentage of 28.07% Next, I have a new field in my destination column that stores the computed "UpTime" percent. To compute, I need to divid the source "totaldowntimemins" by source potentialuptime to get the percentage. I will likely need to multiple by 100 to get the decimal value to move in the position that I need for the destination. ' this line also fails PercentUp = DTSSource("TotalDowntimeMin") / DTSSource("PotentialUptime") ' this line fails - going from source of decimal(5,2) to integer for destination DTSDestination("PercentUp") = DTSSource("TotalDowntimePrc") Main = DTSTransformStat_OK End Function Once I get this routine to work, I need to modify the DTS with a WHERE clause to only transform rows between Jan-1-04 to Jul-23-04. Where do I do this? I believe I selected "table" copy originally and then deleted the default transformation and created my own. Will this work this way? Any help would be appreciated. |
![]() |
| Thread Tools | |
| Display Modes | |
| |