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


Loading NULL in SQL

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

Expert Comment

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;

Author Comment

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 ';';?
LVL 24

Accepted Solution

johanntagle earned 2000 total points
ID: 35624098

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


Author Closing Comment

ID: 35625704
Thank you for your help.

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