2
Vote

Empty strings versus null values

description

When a CSV value is empty such as with the third value in:
Kent,33,,Male
the CSV parser reads this as string.Empty. This is usually fine and desirable, but can cause issues with the data extension's Fill method. If the DataTable being filled has a nullable int column, for example, an empty value should be interpreted as null, otherwise the attempt to add a row will fail.

However, the Fill extension cannot assume that an empty value should be null either, since sometimes it should actually be interpreted as string.Empty. Some kind of hook may be needed to allow client code to determine what constitutes null, if anything. For example, sometimes a missing value should always be null, and sometimes the input may use a special token such as <<NULL>> to indicate null values.

comments