The sql server database converts the date type to other types: CONVERT (type to convert, data to convert, format)

For example, to fuzzy query a datetime type of data, it is not possible to use like directly, you can only convert it to varchar type

At this time, you need to use the CONVERT() function:


CONVERT(varchar,entrytime,120) LIKE  '2018-05-04%'

In this way, as long as the front is 2018-05-04, it will come out.

The third parameter of the function is the date format, which can be ignored. For details, please refer to Baidu: CONVERT()

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325275249&siteId=291194637