• I agree, the code for using OPENROWSET is very interesting.

    But since the stored procedure has to return a result set, what is the advantage over using a table-valued function?