We all know that char (integer_expression) converts the ASCII code to characters. When Integer_expression is an integer between 0 and 255. If the integer expression is not within this range, a NULL value is returned. These are all official information. Specific reference https://msdn.microsoft.com/zh-cn/library/ms187323 (v=sql.120). aspx
However, during our most recent SQL Server 2005 migration upgrade to SQL Server 2014, we found some problems with the official documentation describing the function as a bit of a fallacy. As shown below, in SQL Server 2000 and SQL Server 2005, char (129) to char (254) are returned?. However, a null value is returned from SQL Server 2008 to SQL Server 2014,char (129) to CHAR (254). It is not the official document that says the parameter does not return a null value within 1~255. These must be noted to prevent developers from having special SQL usage errors after the upgrade.
SQL SERVER
SQL SERVER 2005
SQL SERVER 2008R2
SQL SERVER
cases where SQL SERVER CHAR (integer_expression) returns value differences for each version