September 20th, 2012, 03:39 PM
Sql Query help
Trying to bypass programming limitations to solve a customers problem. They are trying to import DOB into our system as mmddyyyy. Our system does not understand this value and its hardcoded to accept mm-dd-yyyy or mm/dd/yyyy. So to bypass I am importing this into the Country field instead of the DOB field
I then run this query
update Patrons set Country = LEFT(country,2)+'/'+substring(country,3,2)+'/'+RIGHT (country,4)
This turns the raw data into the format I need. What I cant seem to figure out myself is the query to say update patrons set country = dob
Heres what I have so far
update Patrons set DateOfBirth = cast(country as daTE) where LEN(Country) =10
Conversion failed when converting date and/or time from character string.
I know I am close but I am missing something. Any ideas?
September 20th, 2012, 04:27 PM
try converting to yyyy-mm-dd first, instead of mm/dd/yyyy, before doing the CAST