Here is your sample data and some code. You tell us what the problem is:
CREATE TABLE abc
(gg_key int,
fg_sta_key int,
fg_eff_dt_key int,
fg_end_dt_key int,
fg_seq_nbr int)
insert into abc values(19925,2,20130128,20130128,1)
insert into abc values (19925,8,20130128,20130128,2)
insert into abc values(19925,1,20130129,20130416,3)
insert into abc values (19925,5,20130417,NULL,4);
select
gg_key,
fg_sta_key,
fg_eff_dt_key,
fg_end_dt_key,
fg_seq_nbr,
cast(cast(fg_eff_dt_key as varchar) as date) as fg_eff_dt,
case when fg_end_dt_key is null then getdate() else cast(cast(fg_eff_dt_key as varchar) as date) end as fg_end_dt,
datediff(day,cast(cast(fg_eff_dt_key as varchar) as date),case when fg_end_dt_key is null then getdate() else cast(cast(fg_eff_dt_key as varchar) as date) end) DayDiff
from abc;
drop table abc;
Questions:
1) Why all the "key" fields (fg_sta_key, fg_eff_dt_key, fg_end_dt_key)
2) Why are date values being stored as integers, these should be stored using date or date/time data types.