Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to change blank to null when export into outfile?

Posted on 2006-06-27
2
Medium Priority
?
384 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
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

618 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