SSIS dataflow - passing nulls (blanks) from query (source) to csv (destination)

  • Good morning - I have a SSIS dataflow that I am simply pulling data from a query (ODBC Source), and outputting this to a .csv file on a daily basis. I have created the pkg.dtsx (SQL 08 Visual Studio 08) in a project, and it works fine EXCEPT it is passing blanks instead of 'null's in the csv file. The programmer using this file would like null in the csv file instead of blanks. I know how to do this if the source is a flat file, but cannot find an option if the source is a query.

    Any help is appreciated..

  • You could try changing NULLS to 'NULL's in your query, something like this (assuming it's not a numeric column):

    COALESCE(MyColumn,'NULL')

    Alternatively, you could put a Derived Column transformation in your data flow to do the same thing.

    John

  • Brian Seib (6/4/2015)


    Good morning - I have a SSIS dataflow that I am simply pulling data from a query (ODBC Source), and outputting this to a .csv file on a daily basis. I have created the pkg.dtsx (SQL 08 Visual Studio 08) in a project, and it works fine EXCEPT it is passing blanks instead of 'null's in the csv file. The programmer using this file would like null in the csv file instead of blanks. I know how to do this if the source is a flat file, but cannot find an option if the source is a query.

    Any help is appreciated..

    What does the programmer want for nulls? The word "NULL"? What represents a blank in the .csv file?

    In my world, in a CSV file, blanks and nulls are the same. They're both the absence of any characters between 2 commas.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply