Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select by Date from DateTime in SQL Server
Message
From
11/08/2017 05:10:18
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
11/08/2017 05:00:11
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01653212
Message ID:
01653233
Views:
58
>>Hi,
>>
>>I am working with the SQL Server database. The field/column is DateTime. And I want to get records by the following criteria:
>>
>>
>>select * from MyTable where DateTimeCol <= '20170810'  
>>
>>
>>Since the DateTimeCol has both the date and time, the above will select 0 records.
>>
>>How should I change the WHERE to make sure that only the Date of DateTime is considered and therefore the records where the Date is '20170810' are returned?
>
>Simply:
>
>
>select * from MyTable where DateTimeCol < '20170811'  
>
Similar to what I was doing a dozen years ago:
select * from MyTable where DateTimeCol <= '20170810 23:59:59'

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform