Solved

How to get retrunvalue from stored procedure to send mail task?

Posted on 2011-09-05
3
184 Views
Last Modified: 2012-05-12
Hi ALL,

I used execute SQL task and defined parameter as returnvalue(int). And add script task to declare the processed success or failure. Atlast connect with send mail task. But I am getting blank email or if process failed = 0. I have three varaibles - sample, returnvalue, and emailMessage. Any suggestion where I missed to get the returnvalue??????

My script task declarations:
        Dim intReturnValue As Integer
        Dim strEmailMessage As String

        intReturnValue = Dts.Variables("ReturnValue").Value

        If intReturnValue = 0 Then
            strEmailMessage = "The Process Failed"
        Else
            strEmailMessage = "The process succeded"
        End If

        Dts.Variables("Sample").Value = strEmailMessage

        Dts.TaskResult = ScriptResults.Success
            
      End Sub
0
Comment
Question by:samthegreat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 36486124
samthegreat,

You have to specify the OUTPUT variable appropriately. See this reference for some options:
http://www.sqlteam.com/article/stored-procedures-returning-data

Hope that helps.
0
 

Author Comment

by:samthegreat
ID: 36516640
Thanks mwvisa1
0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 36516676
You are most welcome!
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
selective rebuild of SQL Tables in scheduled job 10 48
Need multiple Group By's 8 55
grouping by date only 6 22
T-SQL: How to append a column for serialized JSON data? 2 50
Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question