Solved

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

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

706 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

17 Experts available now in Live!

Get 1:1 Help Now