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 ?
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.

Yes you can use

select * from Table1 where entryDate>=getdate() and entryDate<getdate()
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()))
I think you mean:

where entryDate >= dateadd(dd,0, datediff(dd,0, getDate()))
 and entryDate < dateadd(dd,1, datediff(dd,0, getDate()))
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.


Returns the same thing, just in a different way.
take alook into this link to play around Datetime function in SQL and MYSQL
My comment was directed to the first answer.  You are correct and got there first.  :>)


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
newone2011Author Commented:
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.