Solved

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

Posted on 2011-09-05
3
181 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 …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now