sunder.mekala (3/4/2013)
Hi Friends,I have a requirement where i have to write a Sql for :
basically i have 2 columns 'startdate_SK' and 'enddate_SK' columns in table 'A'
'startdate_SK' is a integer ex:99971231
'enddate_SK' is a integer ex: 17530101
requirement: need to find the number of days between the above two columns
ex: 'startdate_SK' - 20130101 and 'enddate_SK' - 20130201 then my result should be 31
IMP:: both columns are integers in the table.
i can use datediff but they are not date columns instead they are integers.
Please suggest, any help is appreciated,
--
Thanks,
Sam.
This: datediff(day,cast(cast(startdate_SK as varchar(8)) as date), cast(cast(enddate_SK as varchar(8)) as date))