Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use only date portion to compare SQL datetime v
Message
De
14/10/2005 13:19:08
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
14/10/2005 11:10:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01059167
Message ID:
01059206
Vues:
13
>Hello
>
>A datetime field in SQL may be 'Oct 1,2005 04:00PM'
>
>But when selecting records for a range of dates from 'Oct 1,2005' to 'Oct 1,2005' , SQL Server assumes a default time of '12:00AM' so the transaction is not selected.
>
>A solution is to set the final search date to 'Oct 1,2005 11:59PM' but my question is : Is it possible to compare only the date portion and ignore the time portion ?
>
>Thanks

It'd take more to ignore time portion IMHO. Adjusting enddate is easier I think. ie:
dStart = {^2005/10/05}
dEnd   = Dtot({^2005/10/05}+1)-1
SQLExec(m.lnHandle,;
 'select * from myTable where myDateTime between ?m.dStart and ?m.dEnd','myCursor')
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform