Solved

sql server 2005 like query does not work for a date

Posted on 2011-03-24
3
427 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)

Join & Write a Comment

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 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

21 Experts available now in Live!

Get 1:1 Help Now