user2834828 user2834828 - 3 months ago 23
MySQL Question

Mysql function DATE() on sql server?

I need to convert this MYSQL query to sql server:

DATE(datetime_field);

How can i translate this query on sql server language?

Thanks.

Answer

You can use either of the following ..

SELECT CONVERT(DATE,datetime_field)

OR

 SELECT CAST (datetime_field as date)