How to enter 'NULL' into SSMS cell?

Michel de Ruiter picture Michel de Ruiter · May 19, 2014 · Viewed 14.9k times · Source

In SQL Server Management Studio 2012, I was typing/pasting data into a table (via Edit Top 200 Rows). Whenever I typed/pasted NULL in a cell, a NULL value was inserted. Apparently it thought I meant the NULL value instead of the 'NULL' text. Which didn't work, as my column wasn't nullable...

Now how do I enter the 'NULL' text into a cell?

If I wanted to insert the NULL value, I would have pressed Ctrl+0...

Answer

qxg picture qxg · May 21, 2014

Just enter 'NULL' (with single quote mark) into cell, SSMS will trim leading and ending single quote mark and save it as string 'NULL'.

Without single quote mark, SSMS will treat input as NULL.