Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning value from Stored Procedure
Message
From
09/10/2003 09:10:10
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Returning value from Stored Procedure
Miscellaneous
Thread ID:
00836786
Message ID:
00836786
Views:
41
I have written the following SP

I am trying to return a concatanated string
ALTER PROCEDURE usp_checkuser 

            @StrAppdi nvarchar(50)

AS


DECLARE @string nvarchar(4000)
SET @string = ''

SELECT @string = @string + CHAR(13) + dbo.DataClass.DataClassDesc
FROM  dbo.SysDataClass INNER JOIN
      dbo.DataClass ON dbo.SysDataClass.DataClassID = dbo.DataClass.DataClassID
WHERE (dbo.SysDataClass.SystemID = @StrAppdi)
ORDER BY dbo.SysDataClass.SystemID

print @string

RETURN @string

GO

declare @myret nvarchar

exec usp_checkuser '421' @myret
But I get these resuts in QA
Name
Car Registration
Travel Details
Server: Msg 245, Level 16, State 1, Procedure usp_checkuser, Line 19
Syntax error converting the nvarchar value '
Name
Car Registration
For some reason it is trying to deliver my results as an integer and falling over. What exec staement do I need to create a meaningful output. I am hoping to to call the returned concatenated string from a .net sqlcommand.

Many Thanks
Next
Reply
Map
View

Click here to load this message in the networking platform