Loading NULL in SQL

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

    Expert Comment

    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

    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


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


    Author Closing Comment

    Thank you for your help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    This article describes some very basic things about SQL Server filegroups.
    A short article about problems I had with the new location API and permissions in Marshmallow
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    761 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

    10 Experts available now in Live!

    Get 1:1 Help Now