Solved

How to change blank to null when export into outfile?

Posted on 2006-06-27
2
354 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
2 Comments
 
LVL 22

Accepted Solution

by:
NovaDenizen earned 500 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now