Solved

sql server 2005 like query does not work for a date

Posted on 2011-03-24
3
438 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:
ewangoya 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to set audit trial on sql server 4 44
sql query help 7 96
How to count the amount of days from a date in the past 2 45
Error when saving to sql table a '/' 5 25
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…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now