Solved

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

Posted on 2011-09-05
3
189 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

627 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