troubleshooting Question

Insert DATETIME to SQL Server

Avatar of JDCam
JDCam asked on
SQLMicrosoft SQL Server
14 Comments4 Solutions20 ViewsLast Modified:
Seems like a very simple thing, yet I have been stuck on this for a while.

As part of an insert I am trying to write CURRENT_TIMESTAMP into a SQL Server DATETIME column. When I select back the inserted record, the date is correct but the time is missing and appears like '2021-07-17 00:00:00.000'

I am currently using a mask of 'yyyy-MM-dd HH:mm:ss'. the same mask used in a select looks fine. 

What am I doing wrong? 
Join our community to see this answer!
Unlock 4 Answers and 14 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros