Alphabetical list of functions
340
HOURS function [Date and time]
Returns the number of hours since an arbitrary date and time, between two
specified times or adds the specified integer-expression amount of hours to a
time.
HOURS (
datetime-expression
|
datetime-expression
,
datetime-expression
|
datetime-expression
,
integer-expression
)
datetime-expression A date and time.
integer-expression The number of hours to be added to the datetime-
expression. If integer-expression is negative, the appropriate number of
hours are subtracted from the datetime. If you supply an integer expression,
the datetime-expression must be explicitly cast as a datetime data type.
$ For information on casting data types, see "CAST function" on
page 318.
The following statement returns the value 17517342:
SELECT HOURS( ’1998-07-13 06:07:12’ )
The following statement returns the value 4, to signify the difference
between the two times:
SELECT HOURS( ’1999-07-13 06:07:12’,
’1999-07-13 10:07:12’ )
The following statement returns the datetime value 1999-05-13 02:05:07.
SELECT HOURS( CAST( ’1999-05-12 21:05:07’ AS DATETIME ),
5)
♦ SQL/92 Vendor extension.
♦
Sybase Not supported by Adaptive Server Enterprise.
IFNULL function [Miscellaneous]
If the first expression is the NULL value, then the value of the second
expression is returned. If the first expression is not NULL, the value of the
third expression is returned. If the first expression is not NULL and there is
no third expression, NULL is returned.
IFNULL (
expression-1
,
expression-2
[ ,
expression-3
] )
expression-1 The expression to be evaluated. Its value determines
whether expression-2 or expression-3 is returned.
Function
Syntax
Parameters
Examples
Standards and
compatibility
Function
Syntax
Parameters