I have a column in sql server like 201801. How can I transform this in DD-MM-YYYY? Thank you!
            Asked
            
        
        
            Active
            
        
            Viewed 51 times
        
    -3
            
            
        - 
                    2What date is that? Datatype? And any chance you fix the schema and use a date datatype instead of strings or ints? – Sean Lange Dec 07 '18 at 14:47
 - 
                    What came up on Google when you researched transforming strings to datetimes? – dfundako Dec 07 '18 at 14:48
 - 
                    It's a string and I need to transform in a date format but to keep it as a string. – Costin Dec 07 '18 at 14:49
 - 
                    Again....what date is that? And why oh why are sticking with using strings? This should be a date and the front end should handle the presentation. – Sean Lange Dec 07 '18 at 14:51
 
1 Answers
0
            
            
        Assuming date column has varchar type, then you can do : 
select convert(varchar(12), cast(col+'01' as date), 105)
from table t;
        Yogesh Sharma
        
- 49,870
 - 5
 - 26
 - 52