I'm trying to select all results of a table whose date is between 2 specific dates like: 11/04/2019 10:20:32
AND 11/04/2019 12:22:34
for example...
I've tried something like this:
SELECT *
FROM myTable
WHERE myDate >= '11/04/2019 10:20:32'
AND myDate <= '11/04/2019 12:22:34';
This query doesn't return any results and in my point of view is corrected. The problem I see here is the fact that is not assuming the right format of date.
So my main answer is: How can I "convert" that date to verify if it's bigger or smaller?
What I've already tried:
How do I query for all dates greater than a certain date in SQL Server?
None of this solutions worked.
EDIT
Using what @Gordon Linoff and the other guys said, I make a search by ID just to see what format is returning on query result and verify that the column of date is returning this: 2019-04-10 10:47:48.000
(datetime)
But when I see all the results of table I verify the column shows this format: 10/04/2019 10:47:48
actually don't know why...
So i've changed my query to this:
SELECT *
FROM myTable
WHERE myDate >= '2019-04-10 10:00:00.000'
AND myDate <= '2019-04-10 11:00:00.000';
And worked! Thanks for the help of everyone.