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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Datatime Convert

Author  Topic 

WoodHouse
Posting Yak Master

211 Posts

Posted - 2009-08-31 : 09:57:24
Hi Guys

I have Datatime table column in varchar(255) format
Like this...
'28/7/2009 12:00:00 AM'

I want to convert like this '2009-04-16 00:00:00.000' to store it into datatime column...

i got this error
Arithmetic overflow error converting expression to data type datetime.

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-08-31 : 09:58:59
u should have mm-dd-yyyy format or yyyy-mm-dd format
Go to Top of Page

WoodHouse
Posting Yak Master

211 Posts

Posted - 2009-08-31 : 10:00:57
Hi

Already data is like this '28/7/2009 12:00:00 AM'
how to convert ......
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-08-31 : 10:01:25
Hi,
use convert(varchar(32),datefield,101)
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2009-08-31 : 10:06:36
convert(datetime,convert(varchar(32),datefield,101))

PBUH
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-08-31 : 10:07:19
select convert(datetime,'28/7/2009 12:00:00' ,103)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -