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)
 how to convert char to datetime

Author  Topic 

dasu
Posting Yak Master

104 Posts

Posted - 2004-09-01 : 09:16:31
i have 8 cbaracters like this
20040808
please convert this to datetime type
please suggest me the solution
regards
dasu.g

raymondpeacock
Constraint Violating Yak Guru

367 Posts

Posted - 2004-09-01 : 09:19:12
CAST('20040808' AS DATETIME)


Raymond
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-09-01 : 09:31:40
this already is considered a datetime. to insert it into the db you just insert it as string
insert into table(dt) values ('20040808'). thats acctually ISO standard for storing dates yyyymmdd.

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page
   

- Advertisement -