Avoid null-value conflicts between access and SQL Server

Source: Internet
Author: User

In an Access project that is linked to a SQL Server database (that is, an. adp file), the access functions that you usually use often do not support. Most of the time, however, you can swap a Transact-SQL (T-SQL) function that is supported by the server. A special case is the null value (NULL) function of Access, NZ and isnull; they are similar in functionality, but not both access and T-SQL can support them. This article discusses when and how to use these two functions to handle null values.

The importance of NULL values

Null values are completely legitimate database entries, and they can provide more information than you might think. A null value indicates that a value is unknown, but this does not mean that the value is not acceptable or does not exist. A null value indicates that a value has not been determined, and that the value remains unknown unless the appropriate value is determined, which is a null value.

The responsibility of the developer is to determine when the null value may appear, and to address those values in a targeted manner. One scenario is to reject null values when data is entered, thereby avoiding them altogether. But in this case, your data will completely prohibit null values, so the disadvantage of this scheme is that when you create a record, all the data must be known. Unfortunately, for most people, this scheme is unrealistic. In the case of a hospital emergency room database system, is it because the data entry clerk refuses to create a record for a patient without knowing the middle name? Therefore, the proper handling of null values provides a more flexible approach, because even if the data entry clerk did not know all the data, it was possible to create records successfully.

Recognizing that null values cannot be avoided, it is your job to handle them properly and ensure that they do not cause errors. There are two benefits to handling null values correctly:

Meaningful information can be shared with the user.

Null values can be captured in advance to avoid null values returning errors in subsequent expressions.

Null values in Access

Access provides a number of tools to manipulate null values:

Is null--uses is Null in conditional expressions and SQL WHERE clauses.

isnull--IsNull is used in visual Basic for Applications (VBA).

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.