MS SQL Query to search between dates

I want to write a query where I can serarch from a table based on date column, however I do not want pass any date.  THe requirement is to always search today's data or yesteday's date betweenn 0000 and 2359 hrs.
For example:

select * from Table1 where entryDate>=todays date 0000 and <todays's date 2359.

for todays's date can I use sysdate or something  like that instead of passing a value from the program ?
newone2011Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

santhimurthydCommented:
Yes you can use

select * from Table1 where entryDate>=getdate() and entryDate<getdate()
0
tim_csCommented:
To search the entire day range you could do something like this.


WHERE entryDate >= DATEADD(d,0,DATEDIFF(d,0,getdate())) AND entryDate < DATEADD(d,0,DATEDIFF(d,-1,getdate()))
0
dqmqCommented:
I think you mean:

where entryDate >= dateadd(dd,0, datediff(dd,0, getDate()))
 and entryDate < dateadd(dd,1, datediff(dd,0, getDate()))
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

tim_csCommented:
dqmq,

Returns the same thing, just in a different way.
0
santhimurthydCommented:
take alook into this link to play around Datetime function in SQL and MYSQL

http://www.w3schools.com/sql/sql_dates.asp
0
dqmqCommented:
Tim,
My comment was directed to the first answer.  You are correct and got there first.  :>)

Dennis  
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
newone2011Author Commented:
Thanks guys let me test
0
newone2011Author Commented:
no
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.