cases where SQL SERVER CHAR (integer_expression) returns value differences for each version

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.