Oracle 5.0 Reference Manual page 862

Table of Contents

Advertisement

• As a 1- or 2-digit number in the range
converted to
Inserting a numeric
a display value of
of
and an internal value of 0000. To specify zero for
0000
2000, specify it as a string
• As the result of a function that returns a value that is acceptable in a
[926].
NOW()
Illegal
YEAR
See also
Section 11.1.5.8, "Two-Digit Years in
11.1.5.4.
YEAR(2)
Although the internal range of values for
0000), the display width for
indicate only the last two digits of the internal values. The result can be a loss of information under
certain circumstances. For this reason, consider avoiding
and using
YEAR(4)
occur when using
YEAR(4). Note that migration will become necessary at some point because support for
types with display values other than 4, most notably YEAR(2), is reduced as of MySQL 5.6.6 and will
be removed entirely in a future release.
Limitations
YEAR(2)
Issues with the
information when values are dumped and reloaded or converted to strings.
• Displayed
that have different internal values to have the same displayed value, as the following example
demonstrates:
mysql>
CREATE TABLE t (y2 YEAR(2), y4 YEAR(4));
Query OK, 0 rows affected (0.01 sec)
mysql>
INSERT INTO t (y2) VALUES(1912),(2012),(2112);
Query OK, 3 rows affected (0.00 sec)
Records: 3
mysql>
UPDATE t SET y4 = y2;
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3
mysql>
SELECT * FROM t;
+------+------+
| y2
| y4
+------+------+
|
12 | 1912 |
|
12 | 2012 |
|
12 | 2112 |
+------+------+
3 rows in set (0.00 sec)
• If you use
values using the same 2-digit representation (12). If you reload the table from the dump file, all
y2
resulting rows have internal value
them.
• Conversion of a
type. Suppose that
values in the ranges
YEAR
has a different effect for
0
and an internal value of 2000. For YEAR(4), the result has a display value
00
or '00'.
'0'
values are converted to 0000.
Limitations and Migrating to
YEAR(2)
wherever you need a
and provides information about migrating existing
YEAR(2)
data type include ambiguity of displayed values, and possible loss of
YEAR(2)
values can be ambiguous. It is possible for up to three
YEAR(2)
Duplicates: 0
Warnings: 0
Changed: 3
Warnings: 0
|
to dump the table created in the preceding item, the dump file represents all
mysqldump
or
YEAR(2)
YEAR(4)
and
YEAR(2)
Date and Time Types
to 99. Values in the ranges
1
to
and
2001
2069
YEAR(2)
Dates".
YEAR(4)
and
YEAR(4)
YEAR(2)
makes that type inherently ambiguous because displayed values
YEAR(2)
data type. This section describes problems that can
YEAR
and display value 12, thus losing the distinctions among
2012
data value to string form uses the display width of the
columns both contain the value 1970. Assigning each
YEAR(4)
842
to
and
1
69
to 1999.
1970
and YEAR(4). For YEAR(2), the result has
and have it be interpreted as
YEAR(4)
context, such as
YEAR
is the same
(1901
throughout your applications
YEAR(2)
YEAR(2)
to
are
70
99
to 2155, and
columns to
data
YEAR
values
YEAR

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents