Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unable to get random generation with OleDb
Message
From
17/09/2006 19:08:59
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
17/09/2006 18:44:24
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01154512
Message ID:
01154516
Views:
10
>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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform