Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find rows with inv_dates
Message
De
01/05/2017 16:42:24
 
 
À
01/05/2017 16:22:59
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., Nouvelle Zélande
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01650725
Message ID:
01650746
Vues:
62
>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.

John

It's C#
I tried your method for a few hours - mainly because of the readability to you mention- and then decided to use Martina's approach.
The minutes on datetimes drive me nuts when trying to query dates, so I use month, day and year where I can.
I don't think DB version will be an issue with that technique.
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform