Welcome to Sign in | Help

Re: DTS import.

  •  09-19-2007, 2:24 PM

    Re: DTS import.

    am rezolvat folosind 2 scripturi de basic
    1:

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------'**********************************************************************
    ' Visual Basic ActiveX Script
    '************************************************************************
    Option Explicit

    Function Main()

    ' Declare FSO Related Variables
    Dim sFolder
    Dim fso
    Dim fsoFolder
    Dim fsoFile
    Dim sFileName


    ' Import Folder
    sFolder = DTSGlobalVariables("ImportFolder")

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set fsoFolder = fso.GetFolder(sFolder)
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set fsoFolder = fso.GetFolder(sFolder)

    For Each fsoFile in fsoFolder.Files
    ' Get first filenme
    sFileName = sFolder & fsoFile.Name
    Exit For
    Next

    'Declare Variables
    Dim oPKG
    Dim oConnection

    ' Get Package Object
    Set oPKG = DTSGlobalVariables.Parent
    ' Get Source Connection Object
    Set oConnection = oPKG.Connections("Connection 1")

    ' Set new Filename
    oConnection.DataSource = sFileName

    Main = DTSTaskExecResult_Success
    End Function


    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    si 2:
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    '**********************************************************************
    ' Visual Basic ActiveX Script
    '************************************************************************
    Option Explicit

    Function Main()

    ' Declare FSO Related Variables
    Dim sFolder
    Dim fso
    Dim fsoFolder
    Dim fsoFilesCollection
    Dim fsoFile
    Dim sFileName

    'Declare Variables
    Dim oPKG
    Dim oConnection

    ' Get Package Object
    Set oPKG = DTSGlobalVariables.Parent
    ' Get Source Connection Object
    Set oConnection = oPKG.Connections("Connection 1")

    ' Import Folder
    sFolder = DTSGlobalVariables("ImportFolder")

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set fsoFolder = fso.GetFolder(sFolder)

    Dim bFound
    bFound = False

    For Each fsoFile in fsoFolder.Files
    sFileName = sFolder & fsoFile.Name
    If oConnection.DataSource = sFileName Then
    bFound = True
    ElseIf bFound = True Then
    oConnection.DataSource = sFileName
    ' Set Pump Step to waiting
    oPKG.Steps("Import_date_wizz Step").ExecutionStatus = DTSStepExecStat_Waiting
    Exit For
    End If
    Next

    Main = DTSTaskExecResult_Success
    End Function
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    am testat cu 500 de fisiere si merge fara probleme
View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems