Show TOC

NEAREST_CENTURY Option [TSQL]Locate this document in the navigation structure

Controls the interpretation of 2-digit years, in string to date conversions.

Allowed Values

0 – 100

Default

50

Scope

Option can be set at the database (PUBLIC) or user level. At the database level, the value becomes the default for any new user, but has no impact on existing users. At the user level, overrides the PUBLIC value for that user only. No system privilege is required to set option for self. System privilege is required to set at database level or at user level for any user other than self.

Requires the SET ANY PUBLIC OPTION system privilege to set this option. Can be set temporary for an individual connection or for the PUBLIC role. Takes effect immediately.

Remarks

NEAREST_CENTURY controls the handling of 2-digit years, when converting from strings to dates or timestamps.

The NEAREST_CENTURY setting is a numeric value that acts as a rollover point. Two-digit years less than the value are converted to 20yy, whereas years greater than or equal to the value are converted to 19yy.

SAP ASE and SAP IQ behavior is to use the nearest century, so that if the year value <yy> is less than 50, then the year is set to 20yy.