I have the following stored procedure.
And the following error
Syntax error converting the nvarchar value '@parent_@iLink' to a column of data type int.
It seems if you don't say what type you want to return it wants to convert it to an int
How do I tell the stored procedure to return a string please ? Been searching for over an hour :s
many thanks
Code:
ALTER PROCEDURE dbo.GetTree
@id int
AS
DECLARE @parent int
DECLARE @iLink nvarchar(50)
SELECT @parent = parent from tlkpnavigation WHERE id = @id
IF @parent = 0
BEGIN
SET @iLink = '@id'
END
ELSE
BEGIN
SET @iLink = '@parent'
END
WHILE (@parent != 0)
BEGIN
SELECT @parent = parent from tlkpnavigation WHERE id = @parent
SET @iLink = '@parent' + '_' + '@iLink'
END
RETURN @iLink
And the following error
Syntax error converting the nvarchar value '@parent_@iLink' to a column of data type int.
It seems if you don't say what type you want to return it wants to convert it to an int
many thanks