Well Erland, Thanx for the reply. Hmmm and i thought i found a better
solution than the one shown in my earlier post. Great! I do not like a
cursor in a function, specially when the table is very large. I think
that i'm gone use the function anyway and when i convert the function
to 2005 i will use your other suggestion to implement in this function.