Function and IF

  • Hi,

    I would like to create a function width condition :

    ALTER

    FUNCTION [dbo].[colorLine](@numberRow [int]) RETURNS [varchar]

    AS

    BEGIN

    DECLARE @moduloSql int

    SET @moduloSql = @numberRow % 1

    IF @moduloSql > 0

       RETURN 'Red';

    ELSE

       RETURN 'Transparent';

    END

    ;

    But I have this message :

    Msg 455, Level 16, State 2, Procedure colorLine, Line 7

    The last statement included within a function must be a return statement.


    Kindest Regards,

    degrem_m
    Degremont

  • Sorry , I am forgoten a finaly return


    Kindest Regards,

    degrem_m
    Degremont

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

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