Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 sql 2000 dts activeX vbscript error trap

Author  Topic 

beyonder422
Posting Yak Master

124 Posts

Posted - 2008-07-24 : 09:23:19
I am running some vbscripts and want to verify I can record any errors that occur.

Below I have included a "forced error" sample that assigns the err.description to a global variable, and in a "failure" process flow I use that global variable as an input for a logging proc - lsited at bottom. So far I am not seeing anything in my log.

What am I doing wrong?

'********************************************************************' Visual Basic ActiveX Script
'********************************************************************
Function Main()

On Error Resume Next

DTSGlobalVariables("ReturnMessage") = ""

Dim objErr

Dim x
Dim y
Dim z

x = 15
y = 0
z = 0

z = x/y

If objErr.Number > 0 Then
DTSGlobalVariables("ReturnMessage") = objErr.Description
Main = DTSTaskExecResult_Failure
Else
DTSGlobalVariables("ReturnMessage") = "Good"
Main = DTSTaskExecResult_Success
End If

End Function

I then have the "Failure" process flow goto an ExecuteSQL object where I want to utilzie the "ReturnMessage" variable as a proc input to log the error message.


Parameter Mapping

Input Global Variables Parameters
"ReturnMessage" "Parameter 1"

usp_djs_log 'STZN - Error Log', ?



Is this the correct method?

Currently, I am not receiving any error message.

I do not define what is obvious...
   

- Advertisement -