home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,184 of 19,505   
   Gene Wirchenko to All   
   Bad Stored Procedure Code: Why?   
   04 Apr 11 14:26:33   
   
   XPost: microsoft.public.sqlserver.programming   
   From: genew@ocis.net   
      
   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 ***'   
      
   select @strBefore   
   execute NiceString @strBefore,@strAfter   
   select @strAfter   
      
   use master   
   go   
      
        What am I missing, please?   
      
   Sincerely,   
      
   Gene Wirchenko   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca