SETting @localvariable(s) within a CASE statement

  • 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

        

             

  • We all have our embarrasing moments and I think this is one of them. A case of trying to hard?

    certainly.

    All I did in the end was:

     C_TYPE + SPACE(LEN(C_TYPE)).......

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply