all groups > sql server dts > july 2003 >
You're in the

sql server dts

group:

GetExecutionErrorInfo does not show errors


GetExecutionErrorInfo does not show errors Dirc
7/10/2003 6:51:05 PM
sql server dts:
Folks

Using SQL Server 2000 SP3

I'm using the GetExecutionErrorInfo in ActiveX Scripting tasks to try and
get error information but the GetExecutionErrorInfo does not return any data
except an error code of zero... consequently the elbaorate tracing and error
handling system we have built around our DTS packages is a bit redundant
until we get meaningful error information propogated out of DTS.

Typical example: I have a copy SQL Server object task which adds data to a
table with a PK. If I try and add the same data again, I should get a
Primary Key constraint error... It does error but the Package
GetExecutionErrorInfo does not contain any SQL Error message.

Can anybody point me in the right direction to sort this out?

Ta

Dirc



Re: GetExecutionErrorInfo does not show errors Darren Green
7/10/2003 7:04:34 PM
In article <u4zjXvwRDHA.1220@TK2MSFTNGP12.phx.gbl>, Dirc
<dirc.khan-evans@eqos.com> writes
[quoted text, click to view]
GetExecutionErrorInfo uses ByRef parameters to pass back the information
such as error description etc. These are type variables, long and string
etc. ActiveX Script only has the variant type. For ByRef to work the
types must match exactly. Using CStr and similar only suppresses the
error by ensuring the data passed in is type correctly, but does not
change the variant to a true string. You will need to use a strongly
type language. You could write a DLL in VB that could be called from
ActiveX Script o even write a custom taks to do the entire error capture
job. Using a custom task gives reuse too, without copy and paste of code
between packages.



--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

Re: GetExecutionErrorInfo does not show errors Dirc
7/10/2003 7:15:36 PM
I know!.. I've seen this before...
Actual code:

'===========================================================
' Do we need to process an issue?
' Look at failed steps
for i = 1 to DTSGlobalVariables.Parent.Steps.Count
Set iStep = DTSGlobalVariables.Parent.Steps.Item(i)
if iStep.ExecutionStatus = DTSStepExecStat_Completed and _
iStep.ExecutionResult = DTSTaskExecResult_Failure then
' Get execution info
iStep.GetExecutionErrorInfo cInt(intErrorCode), _
CStr(strErrorSource), _
CStr( strErrorDescription), _
CSTr(strHelpFile), _
CLng(intHelpContext), _
CStr(strIDIfInError)

' Append it...
objSBDTSFailSteps = objSBDTSFailSteps & " DTSError Step="""
objSBDTSFailSteps = objSBDTSFailSteps & iStep.Name
objSBDTSFailSteps = objSBDTSFailSteps & """ StepDesc="""
objSBDTSFailSteps = objSBDTSFailSteps & iStep.Description
objSBDTSFailSteps = objSBDTSFailSteps & """ Code=""0x"
objSBDTSFailSteps = objSBDTSFailSteps & Hex(intErrorCode)
objSBDTSFailSteps = objSBDTSFailSteps & """ Description="""
objSBDTSFailSteps = objSBDTSFailSteps & strErrorDescription
objSBDTSFailSteps = objSBDTSFailSteps & """"
end if
Set iStep = Nothing
next

'===========================================================

etc.

Anyone got any more ideas I can try?

"Darren Green" <darren.green@reply-to-newsgroup-only.uk.com> wrote in
message news:JQSWNOByqaD$Ew8Q@sqldts.com...
[quoted text, click to view]

Re: GetExecutionErrorInfo does not show errors Darren Green
7/10/2003 8:57:33 PM
In article <#GWEE9wRDHA.2008@TK2MSFTNGP11.phx.gbl>, Dirc
<dirc.khan-evans@eqos.com> writes
[quoted text, click to view]
<snip>

If you know it won't work why are you still trying?

I tried to explain why it will not work, and your only alternative is to
use a strongly type language to call the method-

[quoted text, click to view]


--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

AddThis Social Bookmark Button