Hi,
I am a stored procedure that generates a random character:
create PROCEDURE usp_randchar
@some_length int = 0,
@out varchar(MAX) output
as
WITH random_char(c) AS (
SELECT char(convert(int, rand(abs(convert(int, convert(varbinary, newid())))) * 60.0) + 32)
),
t1 (char_count, s) AS (
SELECT 0, convert(nvarchar(MAX), (SELECT c FROM random_char))
UNION ALL
SELECT char_count + 1, s + (SELECT c FROM random_char) AS s
FROM t1 WHERE char_count < 100
)
SELECT s FROM t1 WHERE char_count = @some_length
return
But I try to assign the output to a variable I just get a Null value:
DECLARE @DFCLNT VARCHAR(1)
EXECUTE usp_randchar 0, @out = @DFCLNT output
SELECT @DFCLNT
Any idea what I am doing wrong?