Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SELECT-SQL, DATE() and DATETIME()
Message
De
31/05/2003 11:32:25
 
 
À
31/05/2003 11:13:50
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00794631
Message ID:
00794875
Vues:
11
Hi Cetin,

for me GETDATE(),NEWID() is good, but RAND() no.

Example:

On MSQL:

Table ( id INT IDENTITY, Name VARCHAR(50), dateStart DATETIME )

no index on dateStart and 1 Million of rows.

I want 5, flat random id, valid today ( i can insert future valid name ).

The query run at 23:59:59.5 ( i am a night worker )

SELECT TOP 5 * FROM Table WHERE dateStart<=GETDATE() AND id=CONVERT(INT,RAND(1)*1000000)

GETDATE() is good but RAND() no;
convert NEWID() to integer flat random is not simple.

Fabio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform