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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Default and Special Datetime Default Values<br />

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

When a DATETIME or a DATETIME-TZ value is defined to a table in the <strong>Data</strong><strong>Server</strong> schema<br />

without a default value, its initial value is automatically set to “?” (the Unknown value). An<br />

option <strong>for</strong> setting the initial value is to use the ABL NOW function. It initializes both date and<br />

time parts of the current date and time and the time zone portion <strong>for</strong> DATETIME-TZ columns.<br />

Using NOW <strong>for</strong> initialization sets the date, time, and time zone based on<br />

SESSION:TIME-SOURCE.<br />

Using Datetime <strong>Data</strong> Types with Stored Procedures<br />

Beginning in <strong>OpenEdge</strong> Release 10.2B, DATETIME-TZ is included as a parameter type that can<br />

be passed to and received from stored procedures.<br />

The DATETIME-TZ data types are definable in both static and dynamic temp tables. There<strong>for</strong>e,<br />

along with parameterization, SEND<strong>SQL</strong> and stored procedure result sets can convert DATETIME-TZ<br />

data types when using LOAD-RESULT-INTO.<br />

If query results derived from a stored procedure are defined by <strong>for</strong>eign data types that require<br />

special mapping in order to retain their value or a portion of their value, they should be CAST to<br />

a type that can handle them. For instance, a TIME data type in a stored procedure result set<br />

should be CAST to a datetime data type that can receive the time component since <strong>OpenEdge</strong><br />

does not support a TIME data type directly. The CAST should be done as part of the result set<br />

be<strong>for</strong>e it is received into a <strong>SQL</strong> View or LOAD-RESULT-INTO temp tables. Similarly, an MS <strong>SQL</strong><br />

<strong>Server</strong> datetime data type with time precision greater than <strong>OpenEdge</strong> should be CAST to a native<br />

datetime data type with the same or less precision than <strong>OpenEdge</strong> be<strong>for</strong>e it is returned in the<br />

result set so it can be properly received. Or, you could CAST a more precise value to a VARCHAR<br />

column in advance and preserve the precision in the alphanumeric <strong>for</strong>m of an <strong>OpenEdge</strong><br />

CHARACTER field.<br />

Datetime index components<br />

Indexing of DATETIME and DATETIME-TZ columns is supported in schema holders. Using<br />

DATETIME-TZ fields in an index is particularly useful since the date and time value is stored in<br />

UTC and there<strong>for</strong>e will display results in absolute time.<br />

Using datetime data types in a WHERE clause<br />

Mixing DATE, DATETIME, DATETIME-TZ in a WHERE clause or in other comparisons will cause<br />

compile time errors and are not valid comparisons.<br />

2–29

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

Saved successfully!

Ooh no, something went wrong!