/*------------------------
SELECT FORMAT(GETDATE() ,'yyyyMMdd')
------------------------*/
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
20171107
(1 row(s) affected)
/*------------------------
SELECT REPLACE(LEFT(CONVERT(VARCHAR, GETDATE(), 20), 10),'-','') FormattedDate
------------------------*/
FormattedDate
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
20171107
(1 row(s) affected)
/*------------------------
SELECT FORMAT(GETDATE() ,'yyyyMMdd')
------------------------*/
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
20171107
(1 row(s) affected)
This works fine in a basic SQL script but when loading the value to my table I'm getting thewhat value you trying to save in your target table? as a date or integer data type, etc?
'20171e+007' value.
the results in my target table look like this... '20171e+007'.This is scientific notation so seems to be that you're using the wrong datatype for that column (should be date or datetime and you're using a numeric datatype).
The target column is varchar(80).