Functions

  • Thanks guys but manged to get it sorted

  • It maybe that there are no ELSE parts in CASE statements.

  •  Try changing this (look for the red):

    CREATE FUNCTION Cupid

    (

    @Date_of_birth datetime, @Star_sign Varchar(50), @Weight INT, @Smoking_habit varchar, @Salary INT)

     

    Without that - @star_sign is a one-character varchar (which means you'd end up with sometihg like 'l'='leo' being evaluated in the case statment).  Also - you should really consider putting in ELSE statements into your CASE statements.  if any one value falls outside of what you're expecting, then the "integer component" will be NULL which means the result will be NULL.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

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

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