Terry,
>Cool, Thanks I hoped it would be something like that. I just forced it with 100 - caredays() AS CareDays and then did a REPLACE ALL CareDays WITH 100 - CareDays - VERY BAD CODE! (Ugly & won't work on cursors). I will use your technique on all future SQLs
That won't help you very much in itself -- it was just to illustrate that you can return a numeric with more than 1 digit by adding zeroes in front. You will have to do something in your function to return a numeric with more than 1 digit.
Someone else may have a more elegant way, but here are a couple of ideas for starters. Assume you have a local variable in your routine called nRetVal, which holds the number from 1 to 31.
RETURN 99-99+nRetVal
gives you an 11-digit numeric in the SELECT, and
RETURN VAL(STR(nRetVal,2))
gives you a 5.2 numeric.