SSIS- retaining null values as null in the csv output file using script task -
i using execute sql task read sql queries , script task write query results csv files using method mentioned in following post on site-
ssis: script task write recordset file (ssis: script task write recordset file). in addition this, require 'null' populated in csv files wherever query result null. how achieve using script task???? additional code have write??
there few ways answer in persist()
within foreeach data row loop:
foreach (system.data.datarow row in table.rows) { // todo: string based fields, capture max length ienumerable<string> fields = (row.itemarray).select(field => field.tostring()); file.writeline(string.join(delimiter, fields)); }
you have test db null in lambda expression. should work though have not tested:
ienumerable<string> fields = (row.itemarray).select(field => ((field == dbnull.value) "null" : field.tostring()));
Comments
Post a Comment