?
Solved

SQL Select Statement

Posted on 2009-07-07
5
Medium Priority
?
219 Views
Last Modified: 2012-05-07
Hello Experts.
I have to fields which are varchar but contain dates.
I would like to do a between clause but i think that i should convert the strings to dates to ensure i am getting the correct values returned. Will you please provide some direction as to how this can be done. Thanks in advance for your assistance


select * from billing where cretedTime between '6/7/2009' and '7/7/2009'
0
Comment
Question by:lemarge
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 1000 total points
ID: 24800076
select * from billing where cretedTime between  cast('6/7/2009' as datetime)  and cast( '7/7/2009' as datetime)
0
 
LVL 40

Assisted Solution

by:mrjoltcola
mrjoltcola earned 1000 total points
ID: 24800142
Which database is this?

Oracle:

select * from billing
  where TO_DATE(cretedTime, 'MM/DD/YYYY') between TO_DATE('6/7/2009', 'MM/DD/YYYY') and TO_DATE('7/7/2009', 'MM/DD/YYYY')

0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24800213
Once again, programming the "Unknown database" sort of like "The Tomb of the Unknown Soldier... "   :)
0
 

Author Comment

by:lemarge
ID: 24800224
i am sorry i will append the database next time. By the way it was SQL Server.. hay dont you sleep..
Have a good night Master Yoda.
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24800285
*wink* you too young Skywalker...
0

Featured Post

DFW AZURE MEETUP TONIGHT FRI 6PM

We will be discussing what Azure Stack is, how does it fit into the suit of offerings that Azure has currently, and where can it fit into your organizations technology stack. We will also be discussing limitations of the platform while covering various applicable scenarios.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question