August 31, 2016 at 3:14 pm
i am querying a date field, it is a smalldate, not null field. The date format in this field is below, i have tried different converts, cast to get date converted to this format but nothing is working. What i tried returns the date but in the time returns the actual time, the field i am querying the time for all records is zeros.
date format in field
210-08-03 00:00:00
What i tried
SELECT CONVERT(datetime, CONVERT(varchar, GETDATE(), 110))
SELECT CAST(GETDATE() AS SMALLDATETIME)
August 31, 2016 at 3:45 pm
There are several ways that you can accomplish this. Probably the most straightforward is the following.
SELECT CAST(CAST(GETDATE() AS DATE) AS SMALLDATETIME)
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy