Convert NULL into "NULL" while exporting data from table to excel.

  • Hi All,

    When I export all the fields from a table to excel (select * from tblname), by defualt it converts all the NULL into empty spaces.

    I don't want that. I want all the NULL values to be string "NULL". Is there any way to do it.?

    Actualy I dont want to use "ISNULL" function as I have many fields in that table and I dont want to convert for each and every fields.

    Any other way to achieve the same ?

    Thanks in advance.

  • One way or another, you're going to have to do a replace somewhere, as there is no global option to tell Excel to display blank cells as NULL, to my knowledge.

    By the way, you mentioned 'empty spaces' - are you suggesting that imported nulls in Excel are different from ordinary blank cells in Excel?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • By the way, you mentioned 'empty spaces' - are you suggesting that imported nulls in Excel are different from ordinary blank cells in Excel?

    No. It's same, blanks.

    So I am left with no option but to replace each n every fields.?

    Thanks for your reply.

  • Not that I can think of, though there is more than one way of doing it:

    1) In the SQL source.

    This is probably where I would do it.

    2) In SSIS - using derived columns.

    3) In Excel - use some VBA code.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

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

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