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
 General SQL Server Forums
 New to SQL Server Programming
 SQL Field Convert nvarchar to datetime

Author  Topic 

Huascar82
Starting Member

6 Posts

Posted - 2007-12-04 : 09:42:56
Hi everyone.

So as the subject says, I have a few fields that are nvarchar but hold date information. Most of these fields I have been able to move to datetime easiliy enough, simply by going into edit mode for the table and converting the fields to datetime. But 1 field is giving me problems I keep getting this error.
quote:
- Unable to modify table.
Arithmetic overflow error converting expression to data type datetime.
The statement has been terminated.


I really dont know why I'm getting this error, but I"m assuming it may have to be something like one of the records may not be in date format. But I don't know if this is the case and I don't know how to locate where my problem is coming from.
Any guidance is greatly appreciated.

Thanks.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-12-04 : 09:44:31
Check which records are creating problem by:

Select col from table where isdate(col) = 0


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Huascar82
Starting Member

6 Posts

Posted - 2007-12-04 : 13:50:30
OMG. That was so easy. Thanks a lot for that harsh. It absolutely did the trick.

Once again, thank you.
Go to Top of Page
   

- Advertisement -