R: DTS Programming

R: DTS Programming

 

  

Thanks Andrew,
I picked a bit , actually i am very much new to dts programming. Here is the code that i am trying but its not working can you please tell me where i am missing some thing.
While situation is same , i need to import data from text files , while text files every time
are named differently. Here i am sending also a picture of the flow of execution. May be you
can suggest what missing out there.
Thanks,

-----------------
Dim fso
Dim Fil
Dim fold
Dim Pkg
Dim counter
Dim stpImport
Const Path = "C:\Documenti\Testing"

' Assign parameters

Set fso = CreateObject("Scripting.FileSystemObject")
Set fold = fso.GetFolder(Path)

set pkg = DTSGlobalVariables.Parent
set conTextFile = pkg.Connections("Text File (Source)")
set stpImport = pkg.Steps("DTSStep_DTSDataPumpTask_1")

Counter = fold.files.count

if counter >= 1 then

for each fil in fold.Files
stpImport.DisableStep = False
DTSGlobalVariables("FileName").Value = fil.path
conTextFile.DataSource = DTSGlobalVariables("FileName").Value
stpImport.ExecutionStatus = DTSStepExecStat_Waiting
Next
else
Msgbox " No File Not Found"

End if




-----Messaggio originale-----
Da: Andrew Farran [mailto:[Email Address Removed] Thursday, May 29, 2003 11:36 AM
A: LazyDBA.com Discussion
Oggetto: RE: DTS Programming


Usman,

You can do this using global variables and an activeX script that changes
the value of the variable as required (either according to the date, or
perhaps by using the FSO object to get the names of current files in a
directory). You would then set the source of a transformation and the
source for a text file connection using script like the following:
---------------
Dim oPkg
Dim oCon
Dim oTasks
Dim oTsk
Dim oPump

'Get a reference to the package.
Set oPkg = DTSGlobalVariables.Parent

'Get a reference to the connections in your package.
For Each oCon In oPkg.Connections
'Check to make sure the package doesn't have an active connection to the
source.
If oCon.Connected = 0 Then
Select Case oCon.Name
Case "my_text_file_source"
oCon.DataSource = strMyTextFileName
End Select
End If
Next

'Now get a reference to the tasks in the package.
Set oTasks = oPkg.Tasks

'Iterate through the tasks and change any details required.
For Each oTsk In oTasks
Select Case oTsk.Description
Case "my_first_transformation"
'Get a reference to the datapump for this task.
Set oPump = oPkg.Tasks(oTsk.Name).CustomTask
'Change the data source.
oPump.SourceSQLStatement = strMyTransformationSourceFileName
End Select
Next

Set oPump = Nothing
Set oTasks = Noting
Set oPkg = Nothing

Hope that helps,

Andrew
----Original Message-----
From: Usman Farhat [mailto:Usman.[Email Address Removed] 29 May 2003 10:13
To: LazyDBA.com Discussion
Subject: DTS Programming


Hi Everyone,
Has someone any sample of dts activex programming of importing data from
text file while text file name keeps on changing randomly.
Thanks,
Usman

--------------------------------------------------------------------
NOTA CONFIDENZIALE:
Questo messaggio ed i suoi allegati sono indirizzati esclusivamente
alle persone indicate in testa e possono contenere informazioni
confidenziali. Se avete ricevuto il messaggio per sbaglio, sappiate
che qualunque utilizzo improprio del contenuto è proibito, Vi
preghiamo quindi di inoltrarlo immediatamente al mittente e di
cancellare il messaggio. Per qualsiasi informazione vi inivitiamo a
contattarci scrivendo a [Email Address Removed] NOTICE:
This message and its attachments are addressed solely to the persons
above and may contain confidential information. If you have received
the message in error, be informed that any use of the content hereof
is prohibited. Please return it immediately to the sender and delete
the message. Should you have any questions, please contact us by replying
to [Email Address Removed] you
--------------------------------------------------------------------

---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] Extra Storage is now available. Get larger attachments -
send/receive up to 2MB attachments (up to 100 percent more per e-mail). Go
to http://join.msn.com/?page=dept/home&pgmarket=en-au


---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] CONFIDENZIALE:
Questo messaggio ed i suoi allegati sono indirizzati esclusivamente
alle persone indicate in testa e possono contenere informazioni
confidenziali. Se avete ricevuto il messaggio per sbaglio, sappiate
che qualunque utilizzo improprio del contenuto è proibito, Vi
preghiamo quindi di inoltrarlo immediatamente al mittente e di
cancellare il messaggio. Per qualsiasi informazione vi inivitiamo a
contattarci scrivendo a [Email Address Removed]

Grazie

CONFIDENTIALITY NOTICE:
This message and its attachments are addressed solely to the persons
above and may contain confidential information. If you have received
the message in error, be informed that any use of the content hereof
is prohibited. Please return it immediately to the sender and delete
the message. Should you have any questions, please contact us by replying
to [Email Address Removed] you
--------------------------------------------------------------------
MS Sql Server LazyDBA home page