Solved

How to change blank to null when export into outfile?

Posted on 2006-06-27
2
346 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

13 Experts available now in Live!

Get 1:1 Help Now