Null Values in SQL server are often confused with Empty or even 0 values but they are in fact Unknown values. This basically means that the values in the Database table’s column cannot be populated appropriately. The information cannot be written because SQL does not know what to write for the requested table’s column value. Since it doesn’t know what to write it cannot insert it appropriately and so it writes NULL as the value. So in essence the value is not empty it is NULL or it can be thought of as a Non value or an unknown value. So in the end as you can see it is not an empty or blank value it is in fact a NULL (Unknown) value that cannot be determined.
Tip: Many years ago (And many SQL versions ago) I leaned to think of Null values as great big question marks and this logic may work for you as well.
Null values can also be values that are not applicable. Take the SMS or ConfigMgr 2007 database for example. You have just completed a network discovery and found several potential client resources. However for one reason or other the client software cannot be installed on some of the detected resources. This may be because they have insufficient disk space or the Domain administrator’s global group was not found in the machines local administrator’s group however since the resource(s) were discovered some of the resources information can be written to the SQL database and some cannot.
For example the Client Version (Client_Version0) for the resource cannot be written as a legitimate value because it is not applicable. This is simply because the client software is not installed and the resource therefore does not have a client version. However as mentioned above some of the information can be written to the database for the discovered resource such as the machine name.
When querying or looking for Unknown or Null values using a Where clause in your SQL query you specify it as in the example below:
Select
Name0
From V_R_System
Where Client_Version0 Is NULL
If you want to find the opposite or the legitimate values add the NOT keyword as in the example here:
Where Client_Version0 Is Not NULL
No Comments