Sorry, but SQL is more than enough in this case. Why would you need a UDF?
Victor
Attachments
Library
Quick Reference
Archives
Sample Index
2005 Indexes