First, it’s useful
update news set author=’jb51′ where author is null
If your is incorrect, it means you have the wrong number. Take a closer look. It is strongly recommended to back up the database before operation.
Description: replaces null with the specified replacement value.
Syntax: isnull (check_expression, replacement_value)
check_ Expression: an expression that will be checked for null. check_ Expression can be of any type.
replacement_ Value: when check_ The expression to return when expression is null. replacement_ Value must be a value that can be implicitly converted to check_ Type of expression type.
Return value: return and check_ Expression is the same type.
Note: if check_ If expression is not null, its value is returned; Otherwise, replace_ Value is implicitly converted to check_ After the type of expression (if the two types are different), the former is returned.
Do not use isnull to find null values. Instead, use is null. The following example finds all products with null in the weight column. Notice the space between is and null.
SELECT Name, Weight
WHERE Weight IS NULL;
SQL Server: how to determine whether a variable or field is null
Determine whether the variable is null:
IF (@VaribleName IS NULL)
Select records with null field value:
WHERE COLUMN_NAME IS NULL
ISNULL(COLUMN_NAME, ‘Default Value’)