Hi sqluser,
you cannot execute a stored procedure or dynamic statement from a function. But what about ...
http://www.sqlservercentral.com/articles/T-SQL/61918/%5B/url%5D and http://www.sommarskog.se/share_data.html#OUTPUT
[font="Verdana"]CU
tosc[/font]