I have a string field dob which has birthdates in various formats e.g.
dob
July 1, 1945
1967-1-7
13 May 1956
8 May 1947
27 September 1953
1952-3-25
I have attempted to use MS SQL 2005 to create a standardized date field
select convert(datetime,dob,103)
from myTable
I get an arithmetic overflow which appears to be associated with the last value, presumably because it is trying to convert the 25 to a month when it is a day
I have tried
setting the language to british and various other styles without success
Any suggestions?
Why would you attempt to store it in a given format? Can you not just store it as a datetime type? The biggest advantage to storing it in a locale independent is that you can offload the presentation logic to the UI where it belongs. Plus, you can avoid messy situations where you have a DOB of 3-4-5 (2003 April 5th, March 4th 2005, 3rd April 2005).
Conversion to a datetime works just fine for me (US locale).
Results