Can someone tell what I can do so that the bit in bold becomes a legal move! 
 (Fails at SET)
BEGIN
   declare @List  varchar(8000)
   declare  @r int
   SELECT 
            @R_List = COALESCE(@List + CHAR(10), '') + 
   CASE
         WHEN (ACOM.FREQ_2 IS NULL)
         THEN
            SET  @r = LEN(C_TYPE)
               C_TYPE + SPACE(@r) + FREQ_1 + SPACE(@r) + C_NAME
I need to adjust the spaces in the returned value of a function. The function itself contains a CASE statement though. Is there anything obvious that's wrong, or shall I offer some more of the query.
Thanks again to all you wonderful folk