convert nchar to datetime in sql server
-
Hi, I have a nchar type in my sql with this kind of value '02 12', it stands for February 2012, is there a way that i can convert this value to DateTime data type in sql server. i was tring these, but none of them are working: *. select convert(DateTime, '02 12') *. select cast('02 12' as DateTime) any help will be greatly appreciated.
-
Hi, I have a nchar type in my sql with this kind of value '02 12', it stands for February 2012, is there a way that i can convert this value to DateTime data type in sql server. i was tring these, but none of them are working: *. select convert(DateTime, '02 12') *. select cast('02 12' as DateTime) any help will be greatly appreciated.
Not a chance, datetime requires a minimum of d/m/y. I would pad it out with something to end up with valid date information. Pick and arbitrary day, 1 or 15 and concat the string then use a date mast to convert it. Look ad convert/cast it will give you the mask types.
Never underestimate the power of human stupidity RAH
-
Hi, I have a nchar type in my sql with this kind of value '02 12', it stands for February 2012, is there a way that i can convert this value to DateTime data type in sql server. i was tring these, but none of them are working: *. select convert(DateTime, '02 12') *. select cast('02 12' as DateTime) any help will be greatly appreciated.