#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    4
    Rep Power
    0
    When exporting data to a CSV via a select...outfile statement null fields are written as a 'N'. Is there any way to change this to something else?

    Thanks, Mike
  2. #2
  3. No Profile Picture
    RyanP
    Guest
    Devshed Newbie (0 - 499 posts)
    use

    if(isnull(fieldName), 'replacement chars', fieldName)

    in your select for whatever fields may be null
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    4
    Rep Power
    0
    I knew there was a way. But I'm still not quite sure where the 'if' statement goes. Here is an example of what I'm doing, where does the 'if' fit in?

    select id_number into outfile "test_file.csv" fields terminated by ',' optionally enclosed by '"' lines terminated by 'rn' from records;

    Thanks.
  6. #4
  7. No Profile Picture
    RyanP
    Guest
    Devshed Newbie (0 - 499 posts)
    select if(isnull(id_number), 'replacement chars', id_number) into outfile "test_file.csv" fields terminated by ',' optionally enclosed by '"' lines terminated by 'rn' from records;

Similar Threads

  1. select verification onsubmit
    By DrStein in forum HTML Programming
    Replies: 3
    Last Post: January 20th, 2004, 03:16 AM
  2. select distinct problem
    By mrengc in forum MS SQL Development
    Replies: 1
    Last Post: December 23rd, 2003, 07:50 AM
  3. Problem with select into outfile
    By Mr Boo in forum MySQL Help
    Replies: 8
    Last Post: December 9th, 2003, 09:25 AM
  4. Help with javascript, passing multiple select array to js then php
    By zen^Wallhack! in forum JavaScript Development
    Replies: 1
    Last Post: December 3rd, 2003, 01:56 PM
  5. Help with function to copy contents of select item
    By MilesDependent in forum HTML Programming
    Replies: 2
    Last Post: November 23rd, 2003, 06:16 PM

IMN logo majestic logo threadwatch logo seochat tools logo