troubleshooting Question

SQL Date Format

Avatar of APD Toronto
APD TorontoFlag for Canada asked on
Microsoft SQL Server 2008SQL
2 Comments1 Solution488 ViewsLast Modified:
Hello Experts,

I have a SQL SELECT with the following condition:
...AND paymentDate >= '6/20/2012' AND paymentDate <= '7/4/2012'

paymentDate is actually a varchar.

The issue is that my statement does not returns the correct data, and after some digging, I have found that the values in paymentDate are sometimes 2010-04-30 and other times 7/13/2010.

I know that within my SQL SELECT I can take care of it by using I think CAST, but I not exactly sure how to go about doing it.

Any help will be greatly appreciated.
Database Analyst
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
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 2 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