How can I get more informations about last error? I get the last error
error, so I can raise the custom error messages for each constraint (like in
MS Access Project).
UPDATE employees SET birthdate = GETDATE()
Will raise the following error message to the client:
Server: Msg 547, Level 16, State 1, Line 1
UPDATE statement conflicted with COLUMN CHECK constraint 'CK_Birthdate'. The
conflict occurred in database 'Northwind', table 'Employees', column
The statement has been terminated.
From which you can get the database, table, column and constraint name if
you need them.
Jacco Schalkwijk MCDBA, MCSD, MCSE
I'm currently working on creating a custom task in VB6.
When it comes to error handling, the recommended error
handling procedure in MSDN is to bubble up the error to
the package event sink using oPackageEvent.onError().
--- Sample Code Starts ---
Private Sub CustomTask_Execute(ByVal pPackage As Object,
ByVal pPackageEvents As Object, ByVal pPackageLog As
Object, pTaskResult As DTS.DTSTaskExecResult)
On Error GoTo errHandler
' Business logic
pTaskResult = DTSTaskExecResult_Success
pTaskResult = DTSTaskExecResult_Failure
if Err.Number=xxxx Then closeConnection
' Bubble errors to the package eventsink
If Not pPackageEvents Is Nothing Then
pPackageEvents.OnError "CustomTask_Execute method
failed", Err.Number, Err.Source, Err.Description, "",
0, "", True
--- Sample Code Ends ---
However, I notice that when error is raised, the specific
error message (Err.Description) will not be displayed on
the DTS Designer execution status dialog box. The only
message I'll get would be "The task reported failure on
I'm not sure if I have done it correctly. Anyone knows how
to get the custom error messages displayed?