?
Solved

sql server 2005 like query does not work for a date

Posted on 2011-03-24
3
Medium Priority
?
471 Views
Last Modified: 2012-08-13
I have a datetime column with a value of 2011-03-03 00:00:00.000

I really don't kow why I could get one row from:
select * from myView where myView.[myDate] = '2011-03-03'

but I can't get anything from:
select * from myView where myView.[myDate] like '%2011-03-03%'

Very appreciated!!!
0
Comment
Question by:jssong2000
[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 Comments
 
LVL 6

Expert Comment

by:HyperBPP
ID: 35206977
You are close:

select * from myView where myView.[myDate] like '2011-03-03%'

0
 
LVL 32

Accepted Solution

by:
Ephraim Wangoya earned 2000 total points
ID: 35207001

Do it like this instead

select *
from myView
where myView.[myDate] BETWEEN '2011-03-03'  AND DATEADD(DD, 1, '2011-03-03')
0
 

Author Closing Comment

by:jssong2000
ID: 35207049
Thank you!!!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

743 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