Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SELECT-SQL, DATE() and DATETIME()
Message
From
31/05/2003 10:53:45
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
31/05/2003 10:35:05
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00794631
Message ID:
00794869
Views:
11
>Cetin,
>
>own problem is not on the time when the SELECT start, but while the SELECT execute, DATETIME() change, and this change is usefull to you.
>
>The process of call DATETIME() is random for the first call, but all next call are correlate with this first event;
>for remove this, is need that the execution process have a white spectre.
>
>For get 5 randomly picked customers, you need SELECT duration is more 5 seconds, and implement one randomization function RANDOM(DATETIME()).
>
>The naturally function for do this task is RAND() function.
>
>I need one exclusive example, that is one SELECT impossible to implement without the DATETIME() dinamically variations.
>
>Fabio

Fabio,
It seems you're fixed to datetime() function. The only usefull dynamic usage "I" can think of that is to generate test data. Apart from that I even find it dangerous to use 'datetime datatype' in comparison parts.

Back to picking 5 customers, fortunately this is easy both in VFP and SQL server :

VFP :
select top 5 rand(),customerID from customers order by 1

SQL server :
select top 5 NewID(),customerID from customers order by 1
* rand() in SQL server behaves as one of those evaluated once at top
* Fortunately newid() doesn't

PS: Don't tell me in VFP top 5 really doesn't mean top 5 all the time. I know, would only help to get the discussion further (in SQL server add 'with ties' and not there too).

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform