Hello Good People,I have been involve with a data warehouse project lately. The source system is based on oracle. Working closely with the resource who can only develop in pl\sql.Kindly help, I need to convert the following code to tsql. select db_stat_date - max(value_date) into vdpd from htd a,gct where acid=vacid and ((a.tran_date,a.tran_id,a.part_tran_srl_num) not in (select tran_date,tran_id,part_tran_srl_num from atd where tran_date=a.tran_date AND tran_id=a.tran_id AND part_tran_srl_num=a.part_tran_srl_num )) and tran_sub_type in ('CI','BS','BI','NR','O') and (tran_particular not like 'FTR%' or tran_particular not like '%: Closure Proceeds' or tran_particular not like '%Disbursement Credit' or tran_particular not like 'REJECT:%') and part_tran_type = 'C' and a.pstd_flg='Y' and a.del_flg='N' and ((a.tran_date,a.tran_id) not in (select tran_date,tran_id from htd b,gam where gam.acid=b.acid and a.tran_date =b.tran_date and a.tran_id = b.tran_id and schm_code in ('OD218','OD220','OD221','OD222','OD223','OD224','OD225','OD226') and b.part_tran_type= 'D' and b.pstd_flg='Y' and b.del_flg='N')) and ((a.tran_date,a.tran_id,a.part_tran_srl_num) not in (select tran_date,tran_id,part_tran_srl_num from ocp where acid=a.acid and tran_date=a.tran_date AND tran_id=a.tran_id AND part_tran_srl_num=a.part_tran_srl_num and STATUS_FLG <>'G')) group by db_stat_date; Exception when no_data_found then null; End;Doing the conversion myself I have been facing with performance issues. I really rely on your contributions on this topic, because am becoming a project risk.kindly see below my conversion giving me performance issues.--declare @vacid varchar(11)--set @vacid = '61217749'declare @vdate datetimedeclare @v_date datetimedeclare @vint intset @vdate = (select max(a.VALUE_DATE)from dbo.SRC_HTD_TABLE aleft outer join(select tran_date ,tran_id from dbo.SRC_HTD_TABLE b,dbo.SRC_GAM gamwhere gam.acid=b.acid and schm_code in ('OD218','OD220','OD221','OD222','OD223','OD224','OD225','OD226') and b.part_tran_type= 'D' and b.pstd_flg='Y' and b.del_flg='N')b on a.tran_date =b.tran_date and a.tran_id = b.tran_idleft outer join(selecttran_id ,tran_date,part_tran_srl_numfromsrc_atd ) c on a.tran_id = c.tran_id and a.tran_date = c.tran_date and a.part_tran_srl_num = c.part_tran_srl_numleft outer join(selecttran_id ,tran_date,part_tran_srl_num,STATUS_FLGfromsrc_ocp) d on a.tran_id = d.tran_id and a.tran_date = d.tran_date and a.part_tran_srl_num = d.part_tran_srl_numwhere b.tran_id is nulland c.tran_id is nulland d.tran_id is nulland d.STATUS_FLG != 'G'and a.tran_sub_type in ('CI','BS','BI','NR','O')and (tran_particular not like 'FTR%' or tran_particular not like '%: Closure Proceeds' or tran_particular not like '%Disbursement Credit' or tran_particular not like 'REJECT:%')and a.part_tran_type = 'C'and a.pstd_flg='Y'and a.del_flg='N'and a.acid = @vacid)set @v_date = (select DB_STAT_DATE from dbo.SRC_GCT)set @vint = (select datediff(day,@vdate,@v_date))It is a actually a function.Many thanksI sign for fame not for shame but all the same, I sign my name.