简体   繁体   中英

SQL NOW() function not working properly

I'm trying to insert the date in aa query, using the NOW() statement.

However only the Ymd are being inserted correctly, while the hours, minutes and seconds are all appearing zeros ( 00:00:00 )

Any reason for that?

Did you check the type of the column you are inserting into? Make sure it's datetime , not just date .

Refer to the docs for more info.

Try this :

SELECT CURRENT_TIMESTAMP
or
SELECT GETDATE()
or
Select {fn NOW()}

Note the accolades in the function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM