Author |
Topic  |
|
ESSetif
Starting Member
USA
2 Posts |
Posted - 03/14/2013 : 10:27:58
|
Hello Everyone,
So I have a column in my table which is date and its represented as four numbers. example : 1109 stands for year 2011 and month 9 ( September )
So am trying to transfer the 1109 to this : 2011-09-01-0000 So basically for day its always going to be 01 and for time its going to be zeros 0000, and pad dashes between the values.
this is what I managed to get so far ============================================================ select
case when convert(int, left(edate, 2)) < 70 then '20' + left(edate,2) else '19' + left(edate,2)
end as 'DATE' from Emp_Date wh
=============================================================
thanks in advance
|
|
webfred
Flowing Fount of Yak Knowledge
Germany
8781 Posts |
Posted - 03/14/2013 : 10:41:00
|
select
case when convert(int, left(edate, 2)) < 70 then '20' + left(edate,2) else '19' + left(edate,2) end + '-' + right(edate,2) + '-' + '01' + '-' + '0000' as 'DATE' from Emp_Date wh
Too old to Rock'n'Roll too young to die. |
 |
|
ESSetif
Starting Member
USA
2 Posts |
Posted - 03/14/2013 : 10:53:37
|
thanks :)
quote: Originally posted by webfred
select
case when convert(int, left(edate, 2)) < 70 then '20' + left(edate,2) else '19' + left(edate,2) end + '-' + right(edate,2) + '-' + '01' + '-' + '0000' as 'DATE' from Emp_Date wh
Too old to Rock'n'Roll too young to die.
|
 |
|
|
Topic  |
|
|
|