do NOT use a scalar UDF if it or the place you are using it does data access. Read my chapter in the SQL Server MVP Deep Dives 2 book entitled "Death by UDF". It is VERY aptly named!! There are umpteen ways UDFs can screw you - just don't go there.
SOMETIMEs an INLINE table-valued-function can be a good thing. That is one of the few exceptions I know of.
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service