Nice example - thanks.

Using a UDF to do table I/O in the "resultset" itself is a nice use - I like it.

I believe that the "don't do table I/O in a UDF" issue is more related to putting a UDF in a WHERE clause that does I/O, as the query optimizer would have a problem evaluating a query path.

We've got a SPROC that determines eligibility for a patient when entering a health claim. Whenever we are asked to populate a "whole" table of patients with eligibility, we have a huge problem - since a SPROC cannot be used as a SELECT column. I'm going to consider changing that SPROC to a UDF so that it can be used in more places.

Thanks again!