sql - Convert free text date value to date data type leads to future year in converted date -
sql - Convert free text date value to date data type leads to future year in converted date -
i facing problem conversion of freetext dob
(date of birth) value valid date info type. using sql server 2008 r2.
following example.
when free text date value 01/28/48
beingness converted through convert function of sql showing 2048
year instead of 1948
future year , not possible in date of birth column.
can help me come out issue?
following screenshot have attached quick reference.
this system-wide setting in sql server - "two-digit year cutoff".
check this:
sp_configure 'show advanced options', 1 reconfigure sp_configure 'two digit year cutoff'
in case, value of 2049
- date year before considered 20xx
year (e.g. 48
-> 2048
), dates year after interpreted 19xx
(70
-> 1970
).
so can either alter setting you, or you'd need write custom t-sql function handle case (always converting dates 19xx
dates - regardless of system-cutoff date)
see more topic in blog post on how set two-digit year cutoff
sql sql-server-2008-r2
Comments
Post a Comment