DTS question

  • Hi,

    I could not find a place MS SQL 2000 DTS folder and placed my question here.

    I am trying to use DTS to import some CSV (or Excell) file into MS SQL 2000. Building dynamic function inside an VB ActiveX Script, it should have someting like:

    "Function Main......DTSDestination(""Col1"") = DTSSource(""" & ColTitle1 & """) ....DTSDestination(""Col2"") = DTSSource(""" & ColTitle2 & """) ....End Function"

    DTSSource is a list of returned value from a stored procedure.  The returned list values should match column name from CSV file. Is there a way I could check whether DTSSource is valid or not? I tried IsEmpty(DTSSource(ColTitle1)) and few other ways; but no luck.

    Thanks.

    CHris

  • Not sure how you get the values but presuming ColTitle1 contains the column name then you could do something like this

    On Error Resume Next

    DTSDestination("Col1") = DTSSource(ColTitle1)

    If Err.Number <> 0 Then

      'Error Do Something

    End if

    DTSDestination("Col2") = DTSSource(ColTitle2)

    If Err.Number <> 0 Then

      'Error Do Something

    End if

    I think Err.Number = 5 if the column is not found

    Far away is close at hand in the images of elsewhere.
    Anon.

  • David,

    Thanks for the helping hand.

    I got ColTitle1 from a stored procedure. One of column name in CSV should match the name of ColTitle1. If anyway I could something like this:

    IF Err(DTSSource(ColTitle1)) <> 1 Then

       set pkg = DTSGlobalVariables.Parent

       set stpbegin = pkg.Steps("DTSStep_DTSActiveScriptTask_3")

    End If

    Chris

      

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

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