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
 Formatting a varchar field

Author  Topic 

velvettiger
Posting Yak Master

115 Posts

Posted - 2008-06-12 : 10:00:53
Hi guys,

How do you convert a date varchar field which looks like 20080525 to 2008/05/25?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-12 : 10:05:01
why is your date stored in a varchar field?It would be really easier to perform calaculations if datatype is datetime. Also you can do formatting using CONVERT() function if its datetime.

Go to Top of Page

velvettiger
Posting Yak Master

115 Posts

Posted - 2008-06-12 : 10:05:53
Hi all,

I got it out. I just used cast(TransactionDate as smalldatetime)
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-12 : 10:21:30
Where do you want to show formatted dates?
If you use front end application, do formation there

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -