dbTalk Databases Forums  

DTS Step failure details in email

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DTS Step failure details in email in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Simon M
 
Posts: n/a

Default DTS Step failure details in email - 07-18-2005 , 07:46 AM






Is there a way to include the error message returned when a step in a DTS
package fails, and then include this in an email task?

Thanks

Reply With Quote
  #2  
Old   
Leo Matter
 
Posts: n/a

Default Re: DTS Step failure details in email - 07-18-2005 , 09:33 AM






here you are:

Option Explicit

Function Main()

Dim oPkg, oTasks, oSendMailTask

' Get Package object
Set oPkg = DTSGlobalVariables.Parent

' Get Tasks collection
Set oTasks = oPkg.Tasks

' Get DTS Send Mail Task by Name
Set oSendMailTask = oTasks("DTSTask_DTSSendMailTask_1").CustomTask

' Set Subject to the Package Name
oSendMailTask.Subject = oPkg.Name

' Set Message Text, including a global variable value
oSendMailTask.MessageText = "Dummy Text." & vbCrLf & _
"MyGlobalVariable Value :" & DTSGlobalVariables("MyGlobalVariable").Value

' Set the attachement to the file of the named connection
oSendMailTask.FileAttachments = oPkg.Connections("Text File
(Destination)").DataSource

' Clean Up
Set oSendMailTask = Nothing
Set oTasks = Nothing
Set oPkg = Nothing

Main = DTSTaskExecResult_Success
End Function

but i would advise you not to use the dts mail task, as it needs a MAPI
client installed on the server. use instead a command line utility like blat
(http://www.blat.net/), which is a lot more easy to configure and more
stable to use.

Regards
Leo Matter

"Simon M" <SimonM (AT) discussions (DOT) microsoft.com> wrote

Quote:
Is there a way to include the error message returned when a step in a DTS
package fails, and then include this in an email task?

Thanks



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.