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 |
|
pmotewar
Yak Posting Veteran
62 Posts |
Posted - 2009-05-18 : 08:03:25
|
| Hi all ,i have 1 column in my table varchar type, which contains the date in text format. but i am not sure about month / date and year sequence. and i want to convert it into datetime format.how can i do that ? any help appreciated.Pankaj |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-05-18 : 08:17:31
|
is the date data format consistent ? All DD-MM-YYYY or MM-DD-YYYY or one of the format ? Or the date can be any format ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
pmotewar
Yak Posting Veteran
62 Posts |
Posted - 2009-05-18 : 08:27:14
|
no date format is not consistent.the date can be any format quote: Originally posted by khtan is the date data format consistent ? All DD-MM-YYYY or MM-DD-YYYY or one of the format ? Or the date can be any format ? KH[spoiler]Time is always against us[/spoiler]
Pankaj |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2009-05-18 : 13:59:27
|
| Is ther any indicator as to what the format is? If not you are pretty much out of luck.. It's pretty tough to tell the difference between: 1/3/2001 and 3/1/2001 |
 |
|
|
mmunson
Starting Member
10 Posts |
Posted - 2009-05-18 : 14:13:53
|
| Pmotewar,You can try something like thisselect CONVERT(varchar, CONVERT(datetime, '20040508'), 100)but like Lamprey said, if it isn't consistent, you're out of luck. |
 |
|
|
pmotewar
Yak Posting Veteran
62 Posts |
Posted - 2009-05-19 : 00:31:04
|
Thanks for the replyquote: Originally posted by mmunson Pmotewar,You can try something like thisselect CONVERT(varchar, CONVERT(datetime, '20040508'), 100)but like Lamprey said, if it isn't consistent, you're out of luck.
Pankaj |
 |
|
|
|
|
|
|
|