MS Sql Help, comparing dates

Hey all, i'm trying to compare a date that is in a field in the database to todays date.

So if dateField=getdate() then...  how do i do this?

if 2/5/2008=2/5/2008 then....

Is there anyway that i can also make it conditional? If there is no match for today, then do a anything < today? thanx all
LVL 3
engineroomAsked:
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.

ee_rleeCommented:
CASE WHEN datefield=getdate() THEN ...
          WHEN datefield>getdate() THEN ...
          ELSE ...
END
0
Aneesh RetnakaranDatabase AdministratorCommented:
if exists (SELECT 1 from urTable Where urDateColumn =CONVERT(VARCHAR, GETDATE(),112) )
  SELECT * FROM urTable Where urDateColumn = CONVERT(VARCHAR, GETDATE(),112)

Else
  SELECT * FROM urTable Where urDateColumn < CONVERT(VARCHAR, GETDATE(),112)
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
engineroomAuthor Commented:
I'll give that a try guys. Just so you know, the

urDateColum is already in a datefield, don't know if that makes a difference or not... does it?
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
Query Syntax

From novice to tech pro — start learning today.