Decode () corresponds to case-when function
Case CHARINDEX ('/', start_point_name)
When 0 then Start_point_name
else substring (start_point_name,1,charindex ('/', start_point_name)-1)
End
Note: The syntax is different when SQL Server uses case to determine whether it is null
Null should be judged by:
Case when identifier was NULL then Airway_point_name else identifier end,
The simplest way is to use the ISNLL function IsNull (idenfier, Airway_point_name)
No way! IsNull (Idenfier, Airway_point_name) will idenfier shortened, originally 5 characters, replaced only 4 characters, the reason is unknown, it is best not to IsNull
The InStr corresponds to the charindex ('/', start_point_name) function, except that the meaning of the two parameters is reversed and is counted starting from 1.
SUBSTR corresponds to the substring parameter exactly the same, but the length parameter cannot be missing, cannot default to the end, can give only a large enough length value.
The Replace function is exactly the same
The length function corresponds to the Len function
Use of functions like Decode, substr, InStr, replace, length, etc. in SQL Server statements 2016.7.10