[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Loading NULL in SQL

Posted on 2011-05-03
4
Medium Priority
?
519 Views
Last Modified: 2012-08-14
How do you insert/load null values from a textual table, in sql?
0
Comment
Question by:JCW2
  • 2
  • 2
4 Comments
 
LVL 24

Expert Comment

by:johanntagle
ID: 35614284
Exactly what is your data source?  Anyway, in SQL:

insert into table_name (column1, column2, column3) values ('this has value',NULL,'you will notice column2 is set to null');

if you're updating an existing row and resetting a column to null:

update table_name set column2=null;
0
 

Author Comment

by:JCW2
ID: 35620981
What about if you're using a text file and a statement like load data infile 'C:/Users/Wild West/Desktop/SQL/Lots#6.txt' into table Lots fields terminated by ';';?
0
 
LVL 24

Accepted Solution

by:
johanntagle earned 2000 total points
ID: 35624098
http://dev.mysql.com/doc/refman/5.6/en/problems-with-null.html

You will have to reprocess your text file and replace empty fields with \N

0
 

Author Closing Comment

by:JCW2
ID: 35625704
Thank you for your help.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

830 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