?
Solved

How to change blank to null when export into outfile?

Posted on 2006-06-27
2
Medium Priority
?
378 Views
Last Modified: 2006-11-18
select * into Outfile 'C:/Java/migrate_boaeft1.txt' fields terminated by "'" lines terminated by '#' from boaeft;


Above is my statement to output to an outfile, it works file, however if my table has an empty entry then I would get '' ( 2 single quotes)   is there a way I can export so when there is a blank, this will change the value to null or 0 so instead of having '', i would have 'null' or '0' ?
0
Comment
Question by:fylix0000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
NovaDenizen earned 2000 total points
ID: 16995548
You would have to specifically list all the fields you are dumping in your select statement.  If field4 is the field you want this behavior for:

select field1, field2, field3, if(length(field4) = 0, 'null', field4), field5, field6..... into Outfile...
0
 

Author Comment

by:fylix0000
ID: 16996686
Thank you NovaDenizen  :),, quite simple yet I do not know how to come up with it.
0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question