dbTalk Databases Forums  

Manually set transformation for data pump

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Manually set transformation for data pump in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
SimplySuzy
 
Posts: n/a

Default Manually set transformation for data pump - 10-10-2006 , 03:28 PM






Help
I have been trying to set the individual transformation for the data
pump in code with no luck. If I use the following code:

Function Main()
'set all the properties for the data pump here before it is executed
dim oPkg, aConn,oConn, oDataPump, oTask
set oPkg = DTSGlobalVariables.Parent
set oConn = oPkg.Connections("Import Destination")
set aConn = oPkg.Connections("File To Import")

'retrieve dynamically set variables
sFile = DTSGlobalVariables("TableName").value
'retrieve dynamically set message code
sDB = DTSGlobalVariables("gvDatabase").value
sDB = replace(sDB,"test1","")
sCCS = DTSGlobalVariables("CCSName").value
'retrieve file path from global variables, append msgcode and date
creating new file name
sFileName = "F:\documents\loads\" & sDB & "\" & sFile & "\MAILnet.txt"

aConn.DataSource = sFileName

'use the datapump to set the name of the table dynamically
Set oDataPump =
oPkg.Tasks("DTSTask_DTSDataPumpTask_2").CustomTask
oDataPump.SourceObjectName = sFileName

oDataPump.DestinationObjectName =
DTSGlobalVariables("gvDatabase").value & ".dbo." & sFile
' dest. table
'inserting new variables for child task that will execute after
completion of this task

oDataPump.DTSDestination("clmnt_idno") =
oDataPump.DTSSource("clmnt_idno")
oDataPump.DTSDestination("name1") = oDataPump.DTSSource("name1")
oDataPump.DTSDestination("name2") = oDataPump.DTSSource("name2")
oDataPump.DTSDestination("name3") = oDataPump.DTSSource("name3")
oDataPump.DTSDestination("addr1") = oDataPump.DTSSource("addr1")
oDataPump.DTSDestination("addr2") = oDataPump.DTSSource("addr2")
oDataPump.DTSDestination("city") = oDataPump.DTSSource("city")
oDataPump.DTSDestination("state") = oDataPump.DTSSource("state")
oDataPump.DTSDestination("zip5") = oDataPump.DTSSource("zip5")
oDataPump.DTSDestination("MNSIsMove") =
oDataPump.DTSSource("MNSIsMove")
oDataPump.DTSDestination("MNSNoSend") =
oDataPump.DTSSource("MNSNoSend")
oDataPump.DTSDestination("MNSADD1") = oDataPump.DTSSource("MNSADD1")
oDataPump.DTSDestination("MNSADD2") = oDataPump.DTSSource("MNSADD2")
oDataPump.DTSDestination("MNSCITY") = oDataPump.DTSSource("MNSCITY")
oDataPump.DTSDestination("MNSSTATE") = oDataPump.DTSSource("MNSSTATE")
oDataPump.DTSDestination("MNSZIP") = oDataPump.DTSSource("MNSZIP")
oDataPump.DTSDestination("MNSZIP4") = oDataPump.DTSSource("MNSZIP4")
oDataPump.DTSDestination("MNSDPBC") = oDataPump.DTSSource("MNSDPBC")
oDataPump.DTSDestination("MNSCHKDIG") =
oDataPump.DTSSource("MNSCHKDIG")
oDataPump.DTSDestination("MNSCART") = oDataPump.DTSSource("MNSCART")
oDataPump.DTSDestination("MNSLOT") = oDataPump.DTSSource("MNSLOT")
oDataPump.DTSDestination("MNSLOTORD") =
oDataPump.DTSSource("MNSLOTORD")
oDataPump.DTSDestination("MNSPRURB") = oDataPump.DTSSource("MNSPRURB")
oDataPump.DTSDestination("MNSMOVTYPE") =
oDataPump.DTSSource("MNSMOVTYPE")
oDataPump.DTSDestination("MNSMOVDT") = oDataPump.DTSSource("MNSMOVDT")

oDataPump.DTSDestination("MNSRETCODE") =
oDataPump.DTSSource("MNSRETCODE")
oDataPump.DTSDestination("MNSGRADE") = oDataPump.DTSSource("MNSGRADE")
oDataPump.DTSDestination("MNSDMA") = oDataPump.DTSSource("MNSDMA")
oDataPump.DTSDestination("MNSLACS") = oDataPump.DTSSource("MNSLACS")
oDataPump.DTSDestination("MNSDPV") = oDataPump.DTSSource("MNSDPV")
oDataPump.DTSDestination("MNSCRMA") = oDataPump.DTSSource("MNSCRMA")
oDataPump.DTSDestination("MNSDPVFL") = oDataPump.DTSSource("MNSDPVFL")

oDataPump.DTSDestination("MNSDPVFN") = oDataPump.DTSSource("MNSDPVFN")

Main = DTSTransformStat_SkipFetch
set oPkg = nothing
Main = DTSStepScriptResult_ExecuteTask
End Function

I will get oDataPump.DTSSource not found

If I remove the oDataPump. from the DTSDestination and the DTS Source I
get the same error.
I have gone as far as resetting both connections to the direct path in
code. If I remove the individual tranformation it will fail with the
must set transformation error.

I have to be able to change the database, table and incoming text file
through global variables on a server that houses over 300 databases.
Surely someone out there knows how to get past using the GUI to set all
attributes in the datapump?

Pretend I KNOW NOTHING (which isn't far from the truth)

I know that anything is possible in code, however, the correct syntax
eludes me.
Thanks in advance
Suzy


Reply With Quote
Reply




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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.