In creating a table table, we can specify that the column package does not contain a value, and that when a column does not contain a value, we can say that it contains null values.
Determines whether the value is null and cannot be simply checked for =null. The SELECT statement has a special WHERE clause that you can use to examine columns that have null values. This WHERE clause is the IS NULL clause.
SELECT * FROM T_check_infodetail the following view:
This time we need to retrieve the checkvaluestring column as a null value, Resultremarks (the field is a blank record)
I'm going to write this code.
Select * from where = NULL and Resultremarks=' '
Then console error:
The data type text and varchar are incompatible in the equal to operator.
Check the following: text type query is not supported =, can support Like,nvarchar (max) data type is a new type, length is equal to text
The function of the text type is very special, so since the beginning of the general Big data type is defined as Max, discard the text, can only datalength (the field name is (resultremarks)) =0 to determine whether it is the length of zero is the field is empty!
So the code changes to this:
Select * from where = NULL and datalength (Resultremarks) = 0
And there was nothing, and this time we looked at the data. It is found that the null value ZAI the database has a special meaning, which is different from the field containing 0, an empty string, or simply containing a space.
So to determine whether a field is empty, you must also use a special WHERE clause is NULL, the code is as follows:
Select * from where is NULL and datalength (Resultremarks) = 0
Ok!
Null (NULL) retrieval of SQL Learning