How do I set a column value to NULL in SQL Server Management Studio?

SqlSql ServerSsms

Sql Problem Overview


How do I clear the value from a cell and make it NULL?

Sql Solutions


Solution 1 - Sql

I think Zack properly answered the question but just to cover all the bases:

Update myTable set MyColumn = NULL

This would set the entire column to null as the Question Title asks.

To set a specific row on a specific column to null use:

Update myTable set MyColumn = NULL where Field = Condition.

This would set a specific cell to null as the inner question asks.

Solution 2 - Sql

If you've opened a table and you want to clear an existing value to NULL, click on the value, and press Ctrl+0.

Solution 3 - Sql

If you are using the table interface you can type in NULL (all caps)

otherwise you can run an update statement where you could:

Update table set ColumnName = NULL where [Filter for record here]

Solution 4 - Sql

Use This:

Update Table Set Column = CAST(NULL As Column Type) where Condition

Like This:

Update News Set Title = CAST(NULL As nvarchar(100)) Where ID = 50

Solution 5 - Sql

Ctrl+0 or empty the value and hit enter.

Solution 6 - Sql

CTRL+0 doesn't seem to work when connected to an Azure DB.

However, to create an empty string, you can always just hit 'anykey then delete' inside a cell.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionZack PetersonView Question on Stackoverflow
Solution 1 - SqlJeff MartinView Answer on Stackoverflow
Solution 2 - SqlZack PetersonView Answer on Stackoverflow
Solution 3 - SqlTheTXIView Answer on Stackoverflow
Solution 4 - SqlMiladView Answer on Stackoverflow
Solution 5 - SqlEppzView Answer on Stackoverflow
Solution 6 - SqlLee SmithView Answer on Stackoverflow