13.01.2013 Views

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Unknown value (?)<br />

<strong>Data</strong> types<br />

The <strong>Data</strong><strong>Server</strong> supports null values. Procedures that use a null value behave exactly<br />

as they do when accessing an Unknown value (?) in an <strong>OpenEdge</strong> database, except<br />

<strong>for</strong> one difference—you cannot compare a field to the Unknown value (?) if the field is<br />

not allowed to hold the Unknown value (?) (i.e., is not null-capable). For example, if the<br />

custnum field is not null-capable, the following statement fails at run time:<br />

FIND customer WHERE customer.custnum NE ?<br />

A column that is not null-capable is marked “mandatory” in the schema holder.<br />

In a <strong>Data</strong><strong>Server</strong> application, you assign the Unknown value (?) to a column by using<br />

the question mark operator (?), which the <strong>Data</strong><strong>Server</strong> translates to the appropriate<br />

null-value representation. For example, the following procedure assigns the Unknown<br />

value (?) to the address2 field of the customer table:<br />

FIND FIRST customer.<br />

customer.address2 = ?.<br />

Zero-length character strings<br />

When you use the Unknown value (?) in a WHERE clause with the <strong>Data</strong><strong>Server</strong>, the<br />

Unknown value (?) satisfies only the equals (=) or not equal () operator. You can also<br />

use a zero-length character string in a WHERE clause. The Unknown value (?) and<br />

zero-length character string are not the same. The Unknown value (?) translates to a<br />

NULL, which is a special marker in a data source that supports NULLs used to represent<br />

missing in<strong>for</strong>mation. On the other hand, zero-length strings and blank columns contain<br />

actual values. Both of the following statements find the first customer record with a<br />

zero-length string in the address2 field. Notice the space between the quotation marks<br />

in the first statement:<br />

FIND FIRST customer WHERE customer.address2 EQ " ".<br />

FIND FIRST customer WHERE customer.address2 EQ "".<br />

Although “” and “ ” evaluate the same way in a WHERE clause, they have different results<br />

when you use them with the BEGINS function. For example, the following statement<br />

retrieves all customer names except those that have the Unknown value (?):<br />

FOR EACH customer WHERE customer.name BEGINS "":<br />

The following statement uses "" to retrieve only those names that begin with a space:<br />

FOR EACH customer WHERE customer.name BEGINS " ":<br />

<strong>OpenEdge</strong> <strong>Data</strong> <strong>Management</strong>: <strong>Data</strong><strong>Server</strong> <strong>for</strong> <strong>Microsoft</strong> <strong>SQL</strong> <strong>Server</strong> 89

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!