views:

415

answers:

1

I'm using the export data wizard in sql server 2005.

I've got a table with null values in many of the fields. I'd like to keep these fields as I export to .csv but they are being replaced with empty strings.

I've tried changing the 'nullable' checkbox for the fields in the wizard, but that doesn't seem to do anything. Also tried using " as a delimiter, since without delimiters, NULL would be interpreted as a string.

+2  A: 

There's no such thing as a null in .csv files. Like you said, a value of null, "null" or "" would all be interpreted as a string value. Consider changing your source so it adds a "ColumnXIsNull" value to the exported records.

Ken Browning
What if the csv was delimited like this: "string","string",NULL - wouldn't that work?
Sam
If that's ok for you then go for it. Like I said, there's no such thing as a null in csv. However you want to signify that a value should be null is fine... as long as whatever is reading the csv understands your convention.
Ken Browning