|
I have a field with data like DEC - 010509 (mmddyy) I am using substring to break it and get the date part out I am using this query to get the date out: CONVERT(datetime, SUBSTRING(CONVERT(VARCHAR(10), SUBSTRING(SSINumber_, 5, 6), 101), 1, 2) + '/' + SUBSTRING(CONVERT(VARCHAR(10), SUBSTRING(SSINumber_, 5, 6), 101), 3, 2) + '/' + '20' + SUBSTRING(CONVERT(VARCHAR(10), SUBSTRING(SSINumber_, 5, 6), 101), 5, 2), 101) I am getting an error when ever i try to query the field "Msg 242, Level 16, State 3, Line 1 The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value."
(comments are locked)
|
|
Abhi... The down/dirty method of getting this quickly...
Returns
This assumes that the column you are converting always contains data in the same format. Regards, Jay
(comments are locked)
|
|
if the mmddyy date is always at the last 6 characters
(comments are locked)
|

