Executing a specific task

  • Function Main()

    Dim oConn

    If DTSGlobalVariables("rowcountstart").Value = 1 then

    Main = DTSTaskExecResult_Success

    Else

    Main = DTSTaskExecResult_Failure

    End If

    End Function

     

    I currently run this with no problem. The one thing I would like to add is an insert into an error table. Is there a way to specify in the ELSE to execute an insert task?

  • I don't know what version of SQL Server you have, but if you are using 2000, you should be able to use ADO to execute a SQL Command.  Like so.....

    Dim oConn                                                                                           

    Set oConn = CreateObject("ADODB.Connection")

    oConn.ConnectionString = <<Connection String>>

    oConn.Open

    oConn.Execute <<SQL Insert Statement>>

    oConn.Close

    Set oConn = Nothing

     

    Let me know if that isn't what you were looking for.

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

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