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)
 character to date

Author  Topic 

IKU
Starting Member

11 Posts

Posted - 2009-07-08 : 13:12:18
Hi,
I need to convert character field into date. Field I need to convert is originaly from txt file and has a format 09.01.2006, now I need to get it in standard sql date format to insert it into date field in my database (2006-01-09).
Does anyone know how to do this, since I have only converted date to char and never char to date.

Thank you

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-08 : 13:20:36
you can use CONVERT. try something like

SELECT CONVERT(datetime,yourfield,104)
Go to Top of Page

IKU
Starting Member

11 Posts

Posted - 2009-07-08 : 13:30:50
Thank you it's working I've missed format, haven't tried 104, but 120
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-08 : 13:32:42
ok. welcome
Go to Top of Page
   

- Advertisement -