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

Click here to load this message in the networking platform