I've been playing with this and it looks like the Scalar UDF in SP06 is very limited. It doesn't support the CHAR data type, and doesn't support any SQL functions.
I thought I could get around my problem by pushing the SQL out into a Scalar Procedure but I can't even do CALL() within the UDF.
Looks like I need to find a different way to solve my problem.
John