>>>Anyway, I showed a generic solution for the field types which can not be easily constructed in SQL.
>>
>>I think the generic solution will work for different field lengths (padr() would still be simpler), but the UNION will fail if you mix different field types.
>
>It sure will.
>
>If you want to have an integer field in your resulting cursor, how would you do it assuming your UDF returns 1,2,3?
Oh, that. OK, in this case you are right. I thought you meant that one and the same function could have different return types. I guess I misunderstood.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)