Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why empty string is returned as 0
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01544288
Message ID:
01544290
Views:
22
I see. I will have to rethink the entire strategy of returning the value in case of an error.
Thank you

>A Return statement in SP supports only integer values
>
>>I have a simple stored procedure that declares a variable @ErrorMessage at the top as
>>
>>declare @ErrorMessage AS VARCHAR(100)
>>SET @ErrorMessage = ''
>>
>>
>>At the end of the procedure I return this value as
>>
>>RETURN @ErrorMessage
>>
>>
>>The value is set to the @ErrorMessage in CATCH block. Then I test this procesure in a query window as following
>>
>>declare @retval as varchar(100)
>>EXECUTE @retval = myproced param1, param2
>>print @retval
>>
>>
>>But if there is no problem within the procedure, the value of @retval showing in the query window is 0 (zero). Why not empty string?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform