tl; dr : How to convert "NULL" in a flat file to NULL in SSDT / SSIS?
In SSMS, run this code:
SELECT * FROM
INSERT INTO
SELECT * FROM
SELECT * FROM
TRUNCATE TABLE
Configure SSMS to create results for CSV with headers: Tools → Options → Query Results → SQL Server → Results for Text: Disabled with comma-separated values, check Enable column headers in the result set.
Your output will look like:
DT,DT2
2017-11-16 10:09:31.997,2017-11-16 10:09:31.9970000
NULL,NULL
2017-11-16 10:09:31.997,9999-12-31 23:59:59.0000000
In SSDT, configure a flat file connection, an extended tab, set the column types to DT_DBTIMESTAMP for DT, DT_DBTIMESTAMP2 for DT2.
(Side question: any idea why SSDT invariably gets this wrong and sets both columns to DT_DATE? Clearly, the columns have a time component.)
RetainNulls = True ( , , null, .. , .
SSDT #target, SSMS? IOW, "NULL" "" NULL .
: