Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server DTS Discussion specific to Data Transformation Service with SQL Server. General SQL Server discussions should use the general SQL Server forum. Readers of the book Professional SQL Server 2000 DTS with questions specific to that book should post in that book forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server DTS section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 23rd, 2005, 09:29 AM
Authorized User
Points: 285, Level: 5
Points: 285, Level: 5 Points: 285, Level: 5 Points: 285, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default DTS Problem with ActiveX Script

Hi folks,

I have a slight problem.

The below code is for the ActiveXScript which is used for the Data Transformation:

Code:
Function Main()

dim arrname

DTSDestination("IHEDAT")=DTSSource("EDDT")
'DTSDestination("ADDIMS")=DTSSource("HLFL")
DTSDestination("IHRELG")=DTSSource("RELG")  

arrname = DTSLookups("lk_epg_eve").Execute(DTSSource("PKEY"),DTSSource("ADDT"))

If IsEmpty(arrname) Then    

                        'MsgBox(DTSSource("PKEY"))

                        'MsgBox(DTSSource("ADDT"))

 

            arrname = DTSLookups("lk_MAT_AD").Execute(DTSSource("PKEY"),DTSSource("ADDT"))

             If IsEmpty(arrname) Then

            Else

                        DTSDestination("IHMROL") = arrname(0)

                        DTSDestination("IHROLL") = arrname(1)

                        DTSDestination("IHADAT") = arrname(2)

                        DTSDestination("IHATIM") = arrname(3)

                        DTSDestination("IHAFLG") = arrname(4)

                        DTSDestination("IHCCON") = arrname(5)

                        DTSDestination("IHCSPC") = arrname(6)

                        DTSDestination("IHWLKY") = arrname(7)

                        DTSDestination("IHTDAT") = arrname(8)

                        DTSDestination("IHTTIM") = arrname(9)

                        DTSDestination("IHPMAN") = arrname(10)

                        DTSDestination("IHSORC") = arrname(11)

                        DTSDestination("IHMETH") = arrname(12)

                        DTSDestination("IHDMET") = arrname(13)

                        DTSDestination("IHDDST") = arrname(14)

                        DTSDestination("IHDDAT") = arrname(15)

                        DTSDestination("IHDTIM") = arrname(16)

                        DTSDestination("IHACAT") = arrname(17)

                        DTSDestination("IHWARD") = arrname(18)

                        DTSDestination("ADDIMS") = arrname(19)

            End If

Else

            'MsgBox(DTSSource("PKEY"))

            DTSDestination("IHMROL") = arrname(0)

            DTSDestination("IHROLL") = arrname(1)

            DTSDestination("IHADAT") = arrname(2)

            DTSDestination("IHATIM") = arrname(3)

            DTSDestination("IHAFLG") = arrname(4)

            DTSDestination("IHCCON") = arrname(5)

            DTSDestination("IHCSPC") = arrname(6)

            DTSDestination("IHWLKY") = arrname(7)

            DTSDestination("IHTDAT") = arrname(8)

            DTSDestination("IHTTIM") = arrname(9)

            DTSDestination("IHPMAN") = arrname(10)

            DTSDestination("IHSORC") = arrname(11)

            DTSDestination("IHMETH") = arrname(12)

            DTSDestination("IHDMET") = arrname(13)

            DTSDestination("IHDDST") = arrname(14)

            DTSDestination("IHDDAT") = arrname(15)

            DTSDestination("IHDTIM") = arrname(16)

            DTSDestination("IHACAT") = arrname(17)

            DTSDestination("IHWARD") = arrname(18)

            DTSDestination("ADDIMS") = arrname(19)

End If

Main = DTSTransformStat_OK

End Function
This code is for the lk_epg_eve lookup

Code:
SELECT     HSPPROG.EPG.PKEY, HSPPROG.EPG.EPSD, HSPPROG.EPG.ADDT, HSPPROG.EPG.ADTM, HSPPROG.EVE.EVT, HSPPROG.EPG.CONS, 
                      HSPPROG.EPG.SPCD, HSPPROG.EPG.WKEY, HSPPROG.EVE."DATE", HSPPROG.EVE."TIME", HSPPROG.EPG.INTN, HSPPROG.EPG.ADSC, 
                      HSPPROG.EPG.ADMT, HSPPROG.EPG.DSMT, HSPPROG.EPG.DSDS, HSPPROG.EPG.EPEN, HSPPROG.EPG.EETM, HSPPROG.EPG.STAT, 
                      HSPPROG.EVE.TWHE, HSPPROG.EVE.CHR1
FROM         HSPPROG.EPG, HSPPROG.EVE
WHERE     HSPPROG.EPG.PKEY = HSPPROG.EVE.PKEY AND HSPPROG.EPG.EPSD = HSPPROG.EVE.EPSD AND (HSPPROG.EVE.EVT IN ('AD', 'TR', 'DS', 'HM')) 
                      AND (HSPPROG.EVE.MODU = 'INP') AND (HSPPROG.EPG.PKEY = ?) AND (HSPPROG.EPG.ADDT = ?)
This code is for the lk_MAT_AD lookup:

Code:
SELECT     HSPPROG.EPG.PKEY, HSPPROG.EPG.EPSD, HSPPROG.EPG.ADDT, HSPPROG.EPG.ADTM, HSPPROG.EVE.EVT, HSPPROG.EPG.CONS, 
                      HSPPROG.EPG.SPCD, HSPPROG.EPG.WKEY, HSPPROG.EVE."DATE", HSPPROG.EVE."TIME", HSPPROG.EPG.INTN, HSPPROG.EPG.ADSC, 
                      HSPPROG.EPG.ADMT, HSPPROG.EPG.DSMT, HSPPROG.EPG.DSDS, HSPPROG.EPG.EPEN, HSPPROG.EPG.EETM, HSPPROG.EPG.STAT, 
                      HSPPROG.EVE.TWHE, HSPPROG.EVE.CHR1
FROM         HSPPROG.EPG, HSPPROG.EVE
WHERE     HSPPROG.EPG.PKEY = HSPPROG.EVE.PKEY AND HSPPROG.EPG.EPSD = HSPPROG.EVE.EPSD AND (HSPPROG.EVE.EVT = 'AD') AND 
                      (HSPPROG.EVE.MODU = 'MAT') AND (HSPPROG.EPG.PKEY = ?) AND (HSPPROG.EPG.ADDT = ?)
It sends two values PKEY and ADDT to two lookups which return and population the fields in the array. Now this is find and great but it is only populating one instance for PKEY and ADDT, where as PKEY and ADDT can be the same but the ENT can be different.

In other words i need the DTS to write the other instances of the same PKEY and ADDT until the end of all the instances, and then move onto the next PKEY and ADDT.

Hope this makes sense, and any help would be gratful.

Thanks
  #2 (permalink)  
Old December 23rd, 2005, 05:11 PM
Friend of Wrox
 
Join Date: Dec 2005
Location: , AZ, .
Posts: 146
Thanks: 0
Thanked 1 Time in 1 Post
Default

TestSubject:

You said you hope that your post makes sense, and since I can get the general feel for what you are doing, even if I can't make sense of the details I am going to recommend an alternate approach.

Rather than trying to a complicated transform I find it easier to setup a staging table (identical structure to the source table) in the destination database. Then Use the Data Pump Task to Pump the data into the staging table without transforms, but using the criteria in a where clause to limit the data. Then once you have the data in your staging table you can do joins to your lookup tables and accomplish your transformations using an insert select statement instead of a data pump task.

David Lundell
Principal Consultant and Trainer
www.mutuallybeneficial.com
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DTS Visual Basic ActiveX Script jemacc SQL Server DTS 4 November 28th, 2007 06:11 PM
dts - formatting excel sheet using activex script Najmunnisha SQL Server DTS 2 May 17th, 2007 11:27 PM
DTS and ActiveX VB Script gscott SQL Server DTS 6 May 16th, 2007 08:38 AM
Accessing DTS scripting object in ActiveX script. panakiom SQL Server DTS 0 August 22nd, 2005 09:41 AM



All times are GMT -4. The time now is 08:30 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.