Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find rows with inv_dates
Message
From
01/05/2017 16:22:59
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
 
 
To
01/05/2017 10:43:39
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01650725
Message ID:
01650743
Views:
66
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform