troubleshooting Question

MS-SQL: Between Date Query Syntax?

Avatar of kvnsdr
kvnsdr asked on
Microsoft SQL Server
4 Comments1 Solution18191 ViewsLast Modified:
I'm looking for dates in an SQL table, but the results are incorrect.

The datetime column looks this way by opening and viewing the table in SQL Enterprise:
8/10/2005 9:44:41 PM.

My query includes this:
BETWEEN '8/16/2005' AND '8/16/2005'

The MS SQL query Analyzer returns these results:
2005-08-11 14:18:29.000

As you can see, the reults are not close to my query dates.

Q. What is the proper syntax to query an SQL table for dates?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros