Hi again Gar,
As far as I recall from VFP Help, UDFs slow down SQL perfomance and work unpredictable. I'm afraid to put this function into long query (which produces ~ 1mln. records)
Not sure, that I understand about shared tables. In from clause, of course, I use shared tables. The resulting table isn't shared and it's name is generated unique name.
Thanks for your help. We'll see, what we can do here.
>Hi again Nadya.
>
>As I said before SYS(2015) won't work for you if you need an integer result.
>
>
>
>Here is a simple (and somewhat lazy) function to do the same thing:
>
>
>FUNCTION unlocalkey
>
>LOCAL lc,lcout
>lc=SUBST(SYS(2015),2,9)
>lcout=""
>FOR i=4 TO 9
> lcout=lcout+ALLTRIM(STR(ASC(SUBSTR(lc,i,1)),3,0))
>NEXT
>RETURN INT(VAL(lcout))
>
>
>
>It produces rather long results. The numbers should be unique for the cursor produced, provided the query does not take more than a few minutes to run.
>This would not be a good thing to do against a shared table (shared in the sense that multiple people were adding records to it at the same time).
If it's not broken, fix it until it is.
My Blog