---
title: "How can manage NULL value in SQL server ?"  
description: "How can manage NULL value in SQL server ?"  
author: "Anonymous User"  
published: 2018-09-17  
updated: 2018-09-17  
canonical: https://www.mindstick.com/forum/34672/how-can-manage-null-value-in-sql-server  
category: "mssql server"  
tags: ["database", "mysql", "sql server"]  
reading_time: 2 minutes  

---

# How can manage NULL value in SQL server ?

[Replace](https://yourviews.mindstick.com/view/81330/cow-antibody-research-in-usa-a-step-ahead-to-replace-plasma-therapy) Blank [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) into [NULL](https://www.mindstick.com/forum/33922/how-to-use-null-coalescing-operator-in-c-sharp) or N/A.

## Replies

### Reply by Anonymous User

The different types of NULL values in Database like -

Blank value.\
Empty value.\
Zero value.\
Optional value.\
Invalid value.\
void value.\
Nothing value.\
Missing value.\
The lowest value.\
Ignorable value.

```
1). Handle NULL value by procedure

 declare @value int=null;if @value is NULLbegin  Select 'Value is NULL' AS Resultendset @value=1if @value is NOT NULLbegin  Select 'Value is not NULL' As Resultend
```

```
Example for "Temprory Table"

declare @ABC table(Col1 int, Col2 varchar(20))
insert into @ABC values(1,'Test 1')
insert into @ABC values(2,'Test 2')
insert into @ABC values(3,'Test 3')
insert into @ABC values(4,'Test 4')
insert into @ABC values(5,'Test 5')
insert into @ABC values(null,'Test 6')
insert into @ABC values(7,'Test 7')
insert into @ABC values(null,'Test 8')
insert into @ABC values(null,'Test 9')
insert into @ABC values(10,'Test 10')

--It returns 3 rows
select * from @Temp where Col1 in(1,3,6)

--It does not include null so it returns 3 rows
select * from @Temp where Col1 in(1,3,6,null)
```

1). Use Ascending order

```
select * from @Temp order by Col1;
```

2). -- Use descending order

```
select * from @ABC order order by Col1 Desc
```

3). Null in GroupBy

```
select col1 count(col2)ASfrom @ABCGroup By Col1
```

4). Case expression

```
select CASE when name IS NULL then 'N/A' else name end from Country---where Country is a table---
```

5). Using COALESCE

```
Select COALESCE(name, 'N/A') from Countries
```

6). ---Return 'N/A' if the name is NULL

```
Select IF(name IS NULL, 'N/A', name) from countries
```

About to NULL value's facts,

it is not equal to or similar as any value \
it is not greater than, less than or different from any type of value\
The null value is not equal to NULL itself. \
it is not greater than, less than or different from NULL values.


---

Original Source: https://www.mindstick.com/forum/34672/how-can-manage-null-value-in-sql-server

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
