Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's to like about a datetime
Message
From
05/09/2018 12:18:12
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
04/09/2018 16:54:06
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
MS SQL Server
Miscellaneous
Thread ID:
01661714
Message ID:
01661826
Views:
68
>>>An exact match and >= or (worse) BETWEEN are not the same thing.
>
>The OP asks about using LIKE which IMHO will involve an explicit or implicit cast to string that's unlikely to benefit from a datetime index.
>
>Whereas exact match, >= and BETWEEN are very likely to use an index if there is one. Nobody is so silly as to suggest all these are the same thing AFAICS.
>
>My answer to Dragan was that his example can be achieved by BETWEEN. If you disagree, the question already has been asked how else LIKE might be intended so unless there are examples, I'm not about to be drawn into straw man arguments.

Next time please do read what the thread is about.
OP was saying he couldn't get a match and neither an error. The question was about LIKE is supported or not.

If you have read my previous replies you would see that I am showing LIKE is supported AND also said that it benefits from an index on the datetime column. But you are (not only you unfortunately) just making assumptions that a datetime (date\datetime2) would go under casting and the index wouldn't be used (That is why I said first check MS SQL insiders). A LIKE search do benefit from an index on a date\datetime\datetime2\datetimeoffset column.

Mind you, you cannot use BETWEEN queries for datetime range searches in MS SQL server.

With a date or datetime2 column, LIKE can be used for searches in the format of yyyy-mm-dd hh:mi:ss.mmm(24h) - this is the ODBC canonical format which clients using ODBC pass in their date\time parameter too.


PS: I am not a native English speaker you know and I hope your "straw man arguments" statement was not an insult on me.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform