Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find rows with inv_dates
Message
De
01/05/2017 16:22:59
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., Nouvelle Zélande
 
 
À
01/05/2017 10:43:39
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01650725
Message ID:
01650743
Vues:
65
Bill,

SQL Server will cache your query for better repeat performance if you use parameters rather than concatenating start and end dates into a query every time.

So if your app can convert year,month,day to a start_date/end_date (watching out for minutes and seconds if it's a datetime field) and use those as BETWEEN parameters, that's very readable and is independent of database version.

Or you could pass all the values to be CAST as dates in your query or via a stored procedure. Depending what language you're using (C#?) IMHO it can be more readable and easier to maintain if you assemble the dates at the app end for use as SQL parameters.
"... 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