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 2000 Forums
 Transact-SQL (2000)
 convert character to date type

Author  Topic 

dbonneau
Yak Posting Veteran

50 Posts

Posted - 2008-03-25 : 19:51:25
Hi, I have a field_1 (mm/dd/yyyy) which is in character type. And I would like to convert the value into date type

This is my code. But it doesn't work this way.

select
field_1,
convert (datetime, field_1,101) as newdate
from table_1



Thanks


Thanks


SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-03-26 : 03:59:45
First run
SELECT * FROM Table_1 WHERE ISDATE(field_1) = 0

to see which records cannot be converted into a date. Correct these and then run the query you posted earlier.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -