H
H
heavybrain2019-08-08 13:51:01
SQL Server
heavybrain, 2019-08-08 13:51:01

How to execute a SQL query on the current date if the date type is datetime?

I have a DATE column with type DATETIME , we need to select all records with today's date.
select date from table where date=getdate() does not work... if you put operators less than or equal to or between then it works....

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
d-stream, 2019-08-08
@heavybrain

where cast(date as date) = cast(getdate() as date)

V
Valery, 2019-08-08
@Desay

date=cast(getdate() as date)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question