Bad Stored Procedure Code: Why? -
04-04-2011
, 04:26 PM
Dear SQLers:
I have written the following stored procedure:
create procedure NiceString
@strIn nvarchar(max),
@strOut nvarchar(max) output
with recompile
as
begin
select @strOut=
ltrim(rtrim(replace(replace(@strIn,nchar(9),N' '),N' ',N' ')))
/* */ select N'NiceString Result:',@strOut
end
go
It works to the degree that the result select shows the correct
value when I run it, but the value of strOut does not get back to the
caller in the following sequence, and strAfter still has its initial
value:
use Banking
go
declare @strBefore nvarchar(max)=N' This is an example. '
declare @strAfter nvarchar(max)=N'*** not assigned to ***'