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)



1 Answer 1


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:

WHERE cast(GetDate() As Date) = '2018-02-12'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .