Author |
Topic |
inbs
Aged Yak Warrior
860 Posts |
Posted - 2011-01-09 : 09:40:19
|
i get column that his type is decimal (the valuse is dates like : 2010060120110101)i want to intoduce them as datetime01-06-201001-01-2010 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-01-09 : 13:08:35
|
somethinng likeSELECT DATEADD(dd,(yourcol%100)-1,DATEADD(mm,((yourcol%10000)/100)-1,DATEADD(yy,(yourcol/10000)-1900,0))) FROM Table ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2011-01-09 : 16:13:10
|
SELECT CONVERT(DATETIME, CAST(Col1 AS CHAR(8)), 112) N 56°04'39.26"E 12°55'05.63" |
|
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2011-01-10 : 00:34:10
|
i want to convert it in reporting services |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-01-10 : 11:36:36
|
use Cdate() and then apply FormatDatetime function------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2011-01-12 : 04:42:40
|
can you give example . |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2011-01-12 : 13:49:39
|
i try all the options,but i get #ERROR.my data is like 20100708 (decimal) |
|
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2011-01-12 : 13:56:17
|
i try 2 options but it wrtire me #ERROR=Formatdatetime(20100708,2)=Formatdatetime(cdate(20100708),2) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-01-13 : 11:14:45
|
try this too=Formatdatetime(cdate("20100708"),2)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2011-01-16 : 03:02:13
|
visakh16 thanks for you help,but it is not working. "Conversion from string "20100708" to type 'Date' is not valid" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-01-18 : 10:16:46
|
What happens when you use 2010-07-08?MadhivananFailing to plan is Planning to fail |
|
|
|