return a single string value from a Stored procedure without using the Output parameters

Go To StackoverFlow.com

0

How to return a single string value from a Stored procedure without using the Output parameters in the SP.

Is this possible ?

The single string value returned by the SP would contain the Sucess or failure message with reason for the failure as well.

How can do this ?

2012-04-05 21:56
by user1316031
SELECT 'Success, it worked' right at the end - ta.speot.is 2012-04-05 21:59
@ta.speot.is you should make that an answe - Conrad Frix 2012-04-05 22:01


0

Something like this at the end of the sp:

IF (SomeCondtion)
BEGIN
   SELECT 'Success'
END
ELSE
BEGIN
  SELECT 'No success'
END

In this link you can find other methods that suit your needs http://www.sqlteam.com/article/stored-procedures-returning-data

2012-04-05 22:01
by Arion
But we have to return the String not just selecting the strin - user1316031 2012-04-05 22:10
@user1316031 - Stored procedures are not like functions. They can only <code>return</code> integers. If you need to return a sting, it must be part of a resultset or an OUT variable - Leigh 2012-04-06 05:15
Ads