Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What's to like about a datetime
Message
De
02/09/2018 15:56:13
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., Nouvelle Zélande
 
 
À
29/08/2018 19:48:23
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
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
MS SQL Server
Divers
Thread ID:
01661714
Message ID:
01661813
Vues:
77
J'aime (1)
>>I don't think your searches was for exact matches. Otherwise you would know that by now. MS SQL server datetime is only have a sensitivity of 3 milliseconds.

More typically BETWEEN or >=?MyDateTime used in parameterized queries without issue since last century. These are converted to SQL @parameterized queries via ODBC for execution plan caching and SQL-injection-proof development. The identical parameterized query also works equally well for Oracle vs SQL Server despite different datetime layouts if you concatenate your parameters into SQL

>>I don't understand what your comment "which casting to string often did not" means at all.

Per Rick's examples, explicit or implicit casting won't always benefit from an index on a datetime field. I don't believe SQL Server stores datetime as a string, so comparing datetime to a string value using LIKE or anything else, risks a table scan. JMHO, I'm a great believer in KISS and parameterized queries are as simple as it gets IMHO.
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us.
"
-- Shakespeare: Coriolanus, Act 1, scene 1
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform