Need to change any and all Nulls to Blanks when Selecting into an Outfile

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BigRedEO
    New Member
    • Aug 2008
    • 2

    #1

    Need to change any and all Nulls to Blanks when Selecting into an Outfile

    I am needing to SELECT all fields/records from a large table (96 columns, over 100 million records) into an outfile. I need to change any "NULL" to a blank. I can use

    "SELECT IFNULL(field_na me,'') FROM table_name WHERE transDate = date INTO OUTFILE '/tmp/sample-file.csv' FIELDS TERMINATED BY '|';",

    but that only works by column name - it does not work for

    "SELECT IFNULL(*,'') FROM TABLE...etc".

    I cannot go through checking IFNULL for every single column individually - much too time consuming and too long to write, plus columns may be added or deleted as time goes along and this will be a script that may need to set to select on a daily or weekly basis.

    Is there a single Mysql command line statement that can change any NULL fields to blank fields when Selecting ALL (*) columns/records into an outfile?
Working...