ODBC Server Reference Manual

Transact-SQL Language
HP NonStop ODBC Server Reference Manual429151-002
4-25
Functions
data-type
is the data type into which the expression is to be converted. It can be any
supported data type.
expression
is the value to be converted.
style
is not supported. The NonStop ODBC Server ignores this parameter.
Converting From a Datetime Value to a Character Value
When converting a datetime value to a character value, the result is displayed in the
format year to fraction 6, as shown in the following example:
select convert (char(26), getdate ())
Year to fraction 6 values require 26 characters, so the data-type must be at least 26
characters long.
For information on year to fraction data, see the NonStop SQL/MP Reference Manual.
Converting a Character Column Value or Local Variable to a Datetime
Value
When converting a character column value or local variable to a datetime value, the
format of the data in the column or local variable must be year to fraction 3. For
example, if the START_DATE column in the following example is a character field, the
data must be in the form year to fraction 3 (such as “1994-01-05:12:29:00.123”).
select convert (datetime, table1.start_date)
Converting a Character String to a Datetime Value
When converting a character literal to a datetime value, the expression can be any
supported datetime format.
select convert (datetime, '1994')
Blank Padding of Character Data
When you convert a character expression to character data of a longer size, the value
is blank-padded on the right.
Truncating Significant Digits
When converting between types with a different number of decimal points, the value is
truncated if trailing significant digits will be lost. If, however, leading significant digits
will be lost, an error message is issued and the statement does not execute.