I'm trying to query using a where clause such as this: WHERE Today = a specific date .
This is what I have right now:
DateAdd(day, 0, GetDate()) = '2018-02-12'
(because it was 2/12 when I posted/tested this)
Help!
I'm trying to query using a where clause such as this: WHERE Today = a specific date .
This is what I have right now:
DateAdd(day, 0, GetDate()) = '2018-02-12'
(because it was 2/12 when I posted/tested this)
Help!
Best Answer
The CAST function in SQL converts data from one data type to another. By casting the GetDate() you're converting it to a string and comparing with a string in format of
'YYYY-MM-DD'
.You can do something like this: