Solved

sql server 2005 like query does not work for a date

Posted on 2011-03-24
3
463 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
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 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delete from table 6 48
Analysis of table use 7 64
create insert script based on records in a table 4 28
Find results from sql within a time span 11 55
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 …
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

696 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