ODBC Server Reference Manual

CORE SQL Language
HP NonStop ODBC Server Reference Manual429151-002
3-23
String Functions
The DATABASE function returns the current database name. The current database
reflects the user’s current session values. These values are set at the time the user
session is first established, using values from the associated profile (ZNSPROF) and
the user’s login request. The current values change during the course of a session
when the user performs actions to set or reset the current environment. The value
returned by DATABASE is always a valid database name as determined by its
existence in the system mapping table ZNSDB.
USER
The USER function has the following syntax:
The USER function returns the logical username of the current user. The current user
is the user who is logged on.
Conversion Function
The NonStop ODBC Server supports the CORE SQL conversion function, CONVERT.
The CONVERT function has the following syntax:
data-type
the data type into which the expression is to be converted. It can be any valid
ODBC data type except a binary type.
value-expression
The value to be converted.
The CONVERT function returns the value of value-expression, converted to the
data type specified by data-type.
If data-type is BIT or TINYINT, it is treated as SMALLINT type. No range checking is
performed.
The CONVERT function cannot appear in the view definition.
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 {fn convert ({fn now()},char(26))} ...
Year to fraction 6 values require 26 characters, so the data-type must be at least 26
characters long.
USER ( )
CONVERT ( value-expression , data-type )