Solved

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

Posted on 2011-09-05
3
182 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
  • 2
3 Comments
 
LVL 59

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 59

Expert Comment

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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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