They are different. When you enclose something in single quotes, it becomes a string -- this is true of all keywords in SQL, including NULL.

When you use just NULL, it is the SQL keyword, and it is compatible with all types.

So, these are quite different:

insert into t (col1, col2)
    values ('2021-05-25 11:58:41.000', NULL);

and:

insert into t (col1, col2)
    values ('2021-05-25 11:58:41.000', 'NULL');

'NULL' is a string and only compatible with a string type. You should get a type-conversion error if the column is not a string.

The one caveat is if you are storing the values in a text file for loading into the database. In such a file, strings may or may not be delimited with single quotes, depending on the structure of the file.

Answer from Gordon Linoff on Stack Overflow
🌐
w3resource
w3resource.com › sql › insert-statement › insert-null.php
Sql inserting NULL values - w3resource
February 13, 2026 - -- INSERT INTO statement begins INSERT INTO agents -- Specifies the table 'agents' where the data will be inserted VALUES ("A001","Jodi","London",.12,NULL); -- Specifies the values to be inserted into each column of the table: -- "A001" will be inserted into the 'agent_code' column (assuming it's a string data type) -- "Jodi" will be inserted into the 'agent_name' column -- "London" will be inserted into the 'working_area' column -- .12 will be inserted into the 'commission' column (assuming it's a numeric data type) -- NULL will be inserted into the 'salary' column, assuming it allows NULL values ... This SQL code attempts to perform an INSERT operation into the 'agents' table.
Discussions

MSSQLServerDatabase ExecuteSQL insert NULL values
When inserting a record into an MS SQL Server database, I check if the controls contain any data or not. If not, I would like to insert NULL values into the related columns in the database. For example, if WebTextField = “”, then insert NULL literal into the database. More on forum.xojo.com
🌐 forum.xojo.com
0
0
August 15, 2022
sql server 2012 - How can i insert data into a NULL record in a column that allows NOT NULLS? - Database Administrators Stack Exchange
I hope my questions makes sense but what i am trying to do (which in my mind is obscenely simple which makes it more frustrating that i cant figure it out) is to change a column that consists of NU... More on dba.stackexchange.com
🌐 dba.stackexchange.com
November 7, 2016
assign null value to string in C# and insert SQL Server decimal column that accepts null values
Find answers to assign null value to string in C# and insert SQL Server decimal column that accepts null values from the expert community at Experts Exchange More on experts-exchange.com
🌐 experts-exchange.com
December 31, 2012
sql server - How to change insert values from 0 to NULL for a specific field in order to avoid foreign key violation? - Database Administrators Stack Exchange
I have a foreign key linking INSTRUMENT.VENDOR to VENDOR.NAME. Unfortunately the program where users enter information is attempting to insert into INSTRUMENT with a value of 0 for vendor. I need to More on dba.stackexchange.com
🌐 dba.stackexchange.com
🌐
GeeksforGeeks
geeksforgeeks.org › sql › how-to-insert-rows-with-null-values-in-sql
How to Insert Rows with NULL Values in SQL? - GeeksforGeeks
July 23, 2025 - Step 6: Display all the rows of the WORKER table including the 0(zero) values. ... Thus, in this way, we can insert NULL values into a table.
🌐
Xojo Programming Forum
forum.xojo.com › targets › web
MSSQLServerDatabase ExecuteSQL insert NULL values - Web - Xojo Programming Forum
August 15, 2022 - When inserting a record into an MS SQL Server database, I check if the controls contain any data or not. If not, I would like to insert NULL values into the related columns in the database. For example, if WebTextField = “”, then insert NULL literal into the database.
🌐
Microsoft Learn
learn.microsoft.com › en-us › sql › t-sql › language-elements › null-and-unknown-transact-sql
NULL and UNKNOWN (Transact-SQL) - SQL Server | Microsoft Learn
July 20, 2026 - To test for null values in a query, use IS NULL or IS NOT NULL in the WHERE clause. You can insert null values into a column by explicitly stating NULL in an INSERT or UPDATE statement, or by leaving a column out of an INSERT statement.
🌐
Experts Exchange
experts-exchange.com › questions › 27981467 › assign-null-value-to-string-in-C-and-insert-SQL-Server-decimal-column-that-accepts-null-values.html
Solved: assign null value to string in C# and insert SQL Server decimal column that accepts null values | Experts Exchange
December 31, 2012 - It's important that the sQL column stays decimal because most of data is decimal format and works, but some cases I need to force an actual NULL value into SQL column. Have tried many suggestions on interent and nothing seems to work. Thanks ... We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads. ... Assign DBNull.Value to the parameter you are inserting.
Find elsewhere
🌐
MySQL
dev.mysql.com › doc › refman › 9.7 › en › problems-with-null.html
MySQL :: MySQL 9.7 Reference Manual :: B.3.4.3 Problems with NULL Values
The meaning of the first can be ... have no phone, and thus no phone number.” · To help with NULL handling, you can use the IS NULL and IS NOT NULL operators and the IFNULL() function....
Top answer
1 of 3
2

The most concordant solution would be to change the front-end application so that, in the first place, it inserts Null instead of 0.

If this isn't possible, it might be relevant to explain why as part of the question, to understand exactly what the profile of limitations are on a solution.

As @SergeyA notes in the comments, it may be a possibility to have a zero-keyed entry in the master table which is used to represent a default or absent link whilst maintaining the referential integrity between the tables.

If you must fall back to triggers, in my view it would be worth considering the possibility of using the trigger to enforce the foreign key selectively, than to use the trigger to rewrite the data on the fly. That is, you would disable the built-in foreign key check, then replace it with a trigger that only enforces the foreign key if it is non-zero, and ignores the enforcement if it is zero.

It is very easy to abuse triggers in ways that make subsequent supervision or re-adaptation of the database extremely difficult and error-prone.

Anything that alters the behaviour of basic SQL commands (such as rewriting an insert zero into an insert null, on the fly), or adds side-effects or forms of reactivity which are not limited to the enforcement of constraints, and does it all in a way that must be completely transparent to a front-end module that cannot be changed, are really the kind of things that are done when an application is already heavily sclerotic and terminally-ill.

2 of 3
0

The only way I know how to do this is to create an INSTEAD OF INSERT trigger on INSTRUMENT. But if I do this, I believe I have to handle all fields in the trigger, and if at any point a new field is added to INSTRUMENT the trigger will need to be updated or that field will never have a value inserted.

This is not necessarily correct.

You'd only have to handle the fields you care about and the ones which are required by the table. If a new nullable field, that you don't care about, was added to the table later on, then that doesn't affect your trigger at all. (Obviously, that new field won't receive data from the source though.)

🌐
Oratechinfo
oratechinfo.co.uk › nulls.html
Using NULLs
SQL> INSERT INTO t VALUES ('X', NULL); 1 row created.
🌐
PC Review
pcreview.co.uk › newsgroups › microsoft dotnet › microsoft ado .net
How do I insert a NULL value inside an INSERT statement | PC Review
December 19, 2003 - You could use a variable that has been set to = DBNull.Value in the statement. ... Hi Dino, Either use parametrized query and pass DBNull.Value as parameter value or use a sql statement like: insert into mytable (field1) values (null);
🌐
Gethyn Ellis
gethynellis.com › 2024 › 06 › understanding-the-sql-insert-statement
Understanding the SQL INSERT Statement - Gethyn Ellis
July 31, 2024 - CREATE TABLE departments ( ... the default constraint. To insert a NULL value into a column, you can explicitly specify NULL in the VALUES clause:...
🌐
Oracle-Base
oracle-base.com › articles › misc › null-related-functions
NULL-Related Functions - ORACLE-BASE
SQL> SELECT * FROM null_test_tab ... FOUR 3 THREE FOUR 4 THREE THREE 3 rows selected. SQL> The NVL function allows you to replace null values with a default value. If the value in the first parameter is null, the function ...
🌐
The Knowledge Academy
theknowledgeacademy.com › blog › how-to-insert-data-in-sql
How to Insert Data in SQL: Syntax, Examples and Query Guide
October 4, 2023 - It’s used when the actual value is unknown or not applicable. Ready to dive into the world of MySQL? Our Introduction to MySQL Course is the perfect starting point! In SQL, inserting data into a table is done using the INSERT INTO statement.
🌐
InformIT
informit.com › articles › article.aspx
NULLs | SQL Server Reference Guide | InformIT
With this table structure in place, we can enter data in two ways. The first way is to specify a NULL in the insert statement, as in this example: INSERT INTO ClientNames VALUES ( ’Buck’ , NULL , ’Woody’) GO
🌐
Coffeebreakdata
coffeebreakdata.com › nulls-in-sql-server
Handling NULLs in SQL Server [Expert Insights 🎯] – Coffee Break Data
To insert a new employee without defining their role initially, you can use the following query: INSERT INTO employees (employee_id, name, role) VALUES (1, 'John Doe', NULL); In this example, NULL specifies that the role attribute is currently unknown or not available.
🌐
Unicom SI
support.unicomsi.com › manuals › soliddb › 201 › solidDB › PGGettingStartedSQL1126755.html
NULL and NOT NULL values
INSERT INTO composers (id, name) VALUES (5, 'Mitchell'); Note that NULL is not the same as zero or an empty string. Unlike NULL, NOT NULL is one of the SQL data constraints. NOT NULL indicates that null values are not allowed in any row of the table for the specified column.
🌐
Microsoft Learn
learn.microsoft.com › en-gb › answers › questions › 1030420 › assign-multiple-values-to-null-value-field-in-azur
Assign multiple values to Null value field IN Azure data factory - Microsoft Q&A
If yes, if cannot be achieved by copy activity. We need to use data flow activity and derived column transformation to replace pqr and xyz by null.
🌐
SQLZoo
sqlzoo.net › wiki › NULL
NULL - SQLZoo
The NULL value may be used to indicate missing or unknown data. You can use the phrase IS NULL to select these values. ... SELECT .. WHERE · SELECT .. GROUP BY · SELECT .. JOIN · SELECT .. SELECT · INSERT ..
🌐
StudySmarter
studysmarter.co.uk › insert sql
INSERT SQL: Insert Command & Example | StudySmarter
August 8, 2023 - Use NULL for optional fields if no value is needed. Utilize leveraging single quotes around string values and no quotes for numeric values.Here's a basic example illustrating these points: INSERT INTO Employees (FirstName, LastName, Age, Salary)VALUES ('Jane', 'Doe', 28, 50000); Avoid using quotation marks around numeric values to prevent SQL errors.