Alphabetical list of functions
376
SELECT YEARS( ’1998-07-13 06:07:12’ )
The following statement returns the value 0, to signify the difference
between the two dates:
SELECT YEARS( ’1999-07-13 06:07:12’,
’1999-09-13 10:07:12’ )
The following statement returns the timestamp value 2004-05-12 21:05:07.
SELECT YEARS( CAST( ’1999-05-12 21:05:07’
AS TIMESTAMP ), 5)
The value of YEARS is calculated from the number of first days of the year
between the two dates.
♦
SQL/92 Vendor extension.
♦
Sybase Not supported by Adaptive Server Enterprise.
YMD function [Date and time]
Returns a date value corresponding to the given year, month, and day of the
month.
YMD (
integer-expression
,
integer-expression
,
integer-expression
)
integer expression The year.
integer expression The number of the month. If the month is outside the
range 1-12, the year is adjusted accordingly.
integer expression The day number. The day is allowed to be any
integer, the date is adjusted accordingly.
The following statement returns the value 1998-06-12.
SELECT YMD( 1998, 06, 12 )
If the values are outside their normal range, the date will adjust accordingly.
For example, the following statement returns the value 1993-03-01
.
SELECT YMD( 1992, 15, 1 )
♦ SQL/92 Vendor extension.
♦
Sybase Compatible with Adaptive Server Enterprise
Usage
Standards and
compatibility
Function
Syntax
Parameters
Examples
Standards and
compatibility