troubleshooting Question

SQL Server datetime formatting

Avatar of Cheryl McCormick
Cheryl McCormick asked on
Microsoft SQL ServerSQL* datetime
20 Comments3 Solutions121 ViewsLast Modified:
Good evening, Gurus,
I need a datetime column to be presented in the 'YYYYMMDD' format.  I've tried all kinds of CONVERT and CAST statements and the results in my target table look like this...  '20171e+007'.  This should be 20171031.  The latest and greatest code =
convert(varchar(10),column_name,112)).  This works fine in a basic SQL script but when loading the value to my table I'm getting the
'20171e+007' value.  The target column is varchar(80).  I've tried DATEPART and just about everything else I can google. Recommendations are very much appreciated!
Join our community to see this answer!
Unlock 3 Answers and 20 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 3 Answers and 20 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