February 20, 2007 at 5:59 am
Hey guy, new to the forum so a big Hello from me!
I have and issue at the moment that I am struggling to overcome. I Have a DTS set with multiple copy SQL Server Objects steps involved. I also have a step which sends a failure email. So I have it set that if the step fails, the failure message is generated, using the Workflow On Failure option. Is there a way that i can in the email message have the name of the step that is failing?! I'm assuming that this could be a global variable if there is such a way.
Any help would be much appreciated.
Thanks Craig
February 20, 2007 at 9:22 pm
Yes, you can send an email using GlobalVariable.
DECLARE @MSG varchar(1000)
DECLARE @Subject varchar(1000)
DECLARE @sRecipients varchar(1000)
select @MSG = 'Dear User,' + char(13) + char(13) + 'You have an error in the step [' + ? + ']. Do not respond to this email as it is auto-generated.' + CHAR(13)
select @Subject = 'Package Error Report'
select @sRecipients = 'Your email address'
exec master.dbo.xp_sendmail
@recipients = @sRecipients
,@message = @MSG
,@subject = @Subject
Now you need to set the GlobalVariable to pass into the script.
Then connect the ActiveXScript task and the Execute SQL Task using Workfliow [On Failure].
February 21, 2007 at 6:34 am
February 21, 2007 at 3:16 pm
For Global Variable: http://msdn2.microsoft.com/en-us/library/aa933470(SQL.80).aspx
For ActiveX Script: http://msdn2.microsoft.com/en-us/library/aa933459(SQL.80).aspx
For Connection: http://msdn2.microsoft.com/en-us/library/aa176223(SQL.80).aspx
For Execute SQL Task: http://msdn2.microsoft.com/en-us/library/aa933511(SQL.80).aspx
For DTS in general: http://msdn2.microsoft.com/en-us/library/aa298646(SQL.80).aspx
February 22, 2007 at 2:14 am
February 22, 2007 at 7:38 am
Terry many thanks as i almost have this working now. I am struggling to get the StepName to appear in the following line:
select @MSG = 'Dear User,' + char(13) + char(13) + 'You have an error in the step [' + ? + ']. Do not respond to this email as it is auto-generated.' + CHAR(13)
Can you help!? I'm presuming I need to replace the '?' with a string!??!
Thanks
Craig
February 22, 2007 at 1:45 pm
No, you do not replace the string but global variable will be replaced automatically. Follow the instruction below but I added this already in the previous mail.
Now you need to set the GlobalVariable to pass into the script.
February 23, 2007 at 2:50 am
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply