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 Char to datetime

Author  Topic 

mufasa
Yak Posting Veteran

62 Posts

Posted - 2003-10-14 : 16:37:52
I am working with a database that has it's date format in char (8)

In a view I am creating I want to convert it to proper date format.

The char date is yyyymmdd (20031014)

I tried using convert and cast, but it does not seem to work.

Thanks for any help

Mufasa

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-10-14 : 16:52:31
It works fine for me. Could you post your code? Here is what I did:

create view v_SomeView
as
select CONVERT(datetime, SomeDateColumn) AS Date from table1
go

What problem are you having?

Tara
Go to Top of Page

mufasa
Yak Posting Veteran

62 Posts

Posted - 2003-10-14 : 17:28:17
Thanks Tara

Dumb mistake on my part, I had CONVERT(MyDateColumn, datetime) AS Date

Thanks again
Mufasa
Go to Top of Page
   

- Advertisement -