Got it working this way, using open query:create table #JDE_ReceiptTable ( jde_trans_date datetime, jde_ticket_no varchar(20), jde_tank_id varchar(16), jde_petroex_code varchar(3), jde_gross_qty dec(15,2), jde_net_qty dec(15,2) )insert into #JDE_ReceiptTable( jde_trans_date, jde_ticket_no, jde_tank_id, jde_petroex_code, jde_gross_qty, jde_net_qty )SELECT *FROM OPENQUERY(AS400SRV_MSDASQL, 'select date(digits(decimal(rcdgj + 1900000,7,0))) as transdate, rcodoc as ticketno, rctank as tankid, rcpex1 as petroex, sum(decimal(rcqty * .01, 31, 2)) as gross, sum(decimal(rcnetg * .01, 31, 2)) as net from VGITFRLIB.F551202A where rcodoc <> '' '' group by date(digits(decimal(rcdgj + 1900000,7,0))), rcodoc, rctank, rcpex1')