Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
venu256
Starting Member
2 Posts |
Posted - 2008-11-06 : 12:06:27
|
| Hi, My Input data is in the format of 2001/12 (Character data type) I want it in datetime format? Is there any way that I can covert that character to datetime format? I've tried both Cast and Convert functions but it is not helping me out..Is there any way that I can get the output? Its very Urgent.. |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2008-11-06 : 12:09:58
|
| what day part would you want there ? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-06 : 12:10:04
|
TrySELECT cast(yourcol+'/01' AS datetime) FROM Table |
 |
|
|
venu256
Starting Member
2 Posts |
Posted - 2008-11-06 : 12:58:32
|
Thank You Very Much.. ...Its working |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-07 : 01:17:08
|
quote: Originally posted by venu256 Hi, My Input data is in the format of 2001/12 (Character data type) I want it in datetime format? Is there any way that I can covert that character to datetime format? I've tried both Cast and Convert functions but it is not helping me out..Is there any way that I can get the output? Its very Urgent..
Do you want to get the date december 01, 2001 for 2001/12?If so, useSELECT cast(replace(your_col,'/','')+'01' AS datetime) from your_tableMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|