>That's the problem. In OleDb, each call is within in its own environment. Thus, that's why it always gives the same result. I don't know how to adjust the SQL so within it, such command could be invoked.
Sorry. I wanted to clarify this point, just in case you didn't know.
Testing repeatedly for rand(-1) will give you the same "random" number several times in a row, before goint to the next one, so that can probably be discarded.
Is it possible to call a UDF from the SELECT statement? If yes, a workaround might be to declare a global variable, to figure out whether the UDF was already invoked before. If the answer is "no", initialize the random number generator (rand(-1)). In any case, just return rand().
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)