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.
| Author |
Topic |
|
dim
Yak Posting Veteran
57 Posts |
Posted - 2010-07-27 : 14:22:09
|
| Hi,I have a column which is of data type char(8).The column values are : 20030212 20030213 20030213I need to convert the column to MM/DD/YYYY format. I tried with the following approach but it does not work.SELECT convert(varchar(10),COLUMN, 101) from TABLENAME But when I do this :select convert( varchar , getdate(), 101) it works and returns data in MM/DD/YYYY format.How do I need to convert the char column to represent column data in MM/DD/YYYY format.Thank You,Dp |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-27 : 14:24:30
|
You have written "But when I do this :select convert( varchar , getdate(), 101) it works and returns data in MM/DD/YYYY format."So what is the problem? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-27 : 14:25:49
|
Ah!select convert( varchar(10) , convert(datetime,COLUMN), 101) No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
dim
Yak Posting Veteran
57 Posts |
Posted - 2010-07-27 : 16:18:08
|
| Thanks it worked.Dp |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-28 : 03:55:03
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|
|