Issue with script task

  • Hi,

    I have a req to send the table data into csv file through SSIS package.for that i have created package which gets data from source to destination that worked fine for me

    2. next scenario i have taken execute sql task and written a query which gets the filename as SDF_5_8_2012.csv

    SELECT DISTINCT

    'SDF_' + rtrim(CONVERT(char(2), MONTH([Load Date]),112)) + '_' + rtrim(CONVERT(char(2), DAY([Load Date]), 112)) + '_' + CONVERT(char(4), YEAR([Load Date]), 112)

    + '.csv' AS Filename

    FROM tablename

    I have two variables

    1.file name - SDF_5_8_2012.csv

    2.fulll path -

    3.In the third scenario using script task for full path variable

    Public Sub Main()

    '

    ' Add your code here

    '

    Dim Pathstring As String

    Dim Filenamestring As String

    Filenamestring = Dts.Variables("User::Filename").Value.ToString

    Pathstring = "X:\ExportCSV\CDE_REPORTS\"

    DateString = Pathstring & Filenamestring

    Dts.Variables("User::FullPath").Value = DateString

    'MsgBox(DateString).ToString()

    Dts.TaskResult = ScriptResults.Success

    End Sub

    End Class

    4.In tha last scenario file system task i am copying SDF to full path

    all the tasks are executed fine but in the script task i am getting error as conversion of string Pathstring = "X:\ExportCSV\CDE_REPORTS\"

    as date.

    Can anyone please help me..

  • Please post the exact text of the error message.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • I am getting problem in the script task -- full path failed

    I have two variables

    1.filename - SDE_5_7_2012.csv

    2.fullpath - X:\ExportCSV\CDE_REPORTS

    Public Sub Main()

    '

    ' Add your code here

    '

    Dim Pathstring As String

    Dim Filenamestring As String

    Dim DateString As String

    Filenamestring = Dts.Variables("User::Filename").Value.ToString

    Pathstring = "X:\ExportCSV\CDE_REPORTS\"

    DateString = Pathstring & Filenamestring

    Dts.Variables("User::FullPath").Value = DateString

    MsgBox(DateString).ToString()

    Dts.TaskResult = ScriptResults.Success

    End Sub

    End Class

    can you please help me what is the issue in the code?

  • Apart from the fact that

    MsgBox(DateString).ToString()

    looks weird (use MsgBox(DateString) instead), I can't see a problem. But if you post the full text of the error message (just copy & paste), it may throw more light on the problem.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply