Sample programs

Consider the following scenario: An Embedded SQL program defines a cursor to retrieve rows from the titles table in the pubs2 database. The WHERE clause uses non-ANSI standard NULL checking. To clarify, IS NULL and IS NOT NULL are ANSI standards which is the default used by Embedded SQL programs. However, an Embedded SQL program wishing to use = NULL or != NULL will need to turn OFF ANSINULL behavior and use Transact-SQL syntax instead. If you wanted to make comparisons with NULLs in Transact-SQL syntax in Embedded SQL prior to version 11.1, you would need to make the following call:

EXEC SQL set ansinull off END-EXEC.

In the following example, no change is made to the Embedded SQL code, but the desired behavior is attained by setting appropriate properties in the Open Client/Server configuration file.

There are two versions of the same program listed below. One is to be used with the -e option and the other with the -x option.