Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL query in SQL SERVER 2005 - Comparing Dates

I'm having a hard time doing this query. I want to compare dates in my query, dates from my DB are in this format:
(MM/DD/YYYY HH:MM:SS AM)
I want to compare this date with tomorrow's day, today plus one.
My questions are:

How do I declare tomorrow's date in sql server?
How would you compare these two dates?

Thank you!! =D

EDIT : DATES in DB are VarChar =S

like image 639
hyeomans Avatar asked Dec 07 '25 08:12

hyeomans


1 Answers

declare tomorrow's date : DATEADD(dd,1,getdate())

compare dates :

WHERE column >= CONVERT(datetime, CONVERT(varchar, DATEADD(day, 1, GETDATE()), 102))
    AND column < CONVERT(datetime, CONVERT(varchar, DATEADD(day, 2, GETDATE()), 102))
like image 68
anishMarokey Avatar answered Dec 09 '25 20:12

anishMarokey