[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

SQL Select Statement

Posted on 2009-07-07
5
Medium Priority
?
224 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

650 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