各位大神,我跑下面这段代码的时候一直报如下错误:
SQLServerException: Arithmetic overflow error converting expression to data type int.
我google说是类型溢出,可是我改成bigint之后依然报相同的错,求指导!!!先膜拜了
first.orderid,first.oilfee,first.tax,first.price,first.maxsequence,first.tot_RecommendLevel,first.serverfee,
second.takeofftime,second.arrivaltime,second.TakeoffTimekey,second.ArrivalTimekey,second.dcity,second.acity,
second.DPort_First,second.APort_First,second.acitycode,second.dcitycode,second.needappl
,o.orderdate
,o.amount
,o.quantity
,o.persons
,o.cost
,o.insurancefee
,o.orderstatus
,o.flightclass
,o.flightway
,o.isonline
,o.eid
,o.uid
,o.isenglish
,o.serverfrom
,o.ispackageorder
,o.finishdate
,o.emoney
,o.cancelreason
,o.changereason
,o.prepaytype
,o.isrebook
,o.reference
,o.Eticket
,o.userip
,o.processstatus
,o.vipgrade
,o.TicketStatus
,o.FlightAgency
,o.Manualset
,o.SendTicketCity
,o.bookingchannel
,ofe.SaleType
,fiop.OwnerAirline
from(select orderid,sum(cast(oilfee as bigint)) as oilfee,sum(cast(tax as bigint)) as tax,sum(cast(price as bigint)) as price,
max(cast(sequence as bigint)) as maxsequence,sum(cast(RecommendLevel as bigint)) as tot_RecommendLevel,sum(cast(serverfee as bigint)) as serverfee
from fltorderdb..O_Flight
group by orderid) as first inner join
(select distinct zf.orderid,f1.takeofftime,f2.arrivaltime,TakeoffTimekey,ArrivalTimekey,f1.needappl,
f1.dcity,f2.acity,f1.DPort as DPort_First,f2.APort as APort_First,
dcity1.citycode as dcitycode,acity1.citycode as acitycode
from
(select orderid,
cast((substring(convert(varchar(50),f.takeofftime,120),1,4)-2000)*1000000 as bigint)+
cast(substring(convert(varchar(50),f.takeofftime,120),6,2)*10000 as bigint)+
cast(substring(convert(varchar(50),f.takeofftime,120),9,2)*100 as bigint)+
cast(substring(convert(varchar(50),f.takeofftime,120),12,2) as bigint)-9999 as TakeoffTimekey,
cast((substring(convert(varchar(50),f.arrivaltime,120),1,4)-2000)*1000000 as bigint)+
cast(substring(convert(varchar(50),f.arrivaltime,120),6,2)*10000 as bigint)+
cast(substring(convert(varchar(50),f.arrivaltime,120),9,2)*100 as bigint)+
cast(substring(convert(varchar(50),f.arrivaltime,120),12,2) as bigint)-9999 as ArrivalTimekey,
takeofftime,arrivaltime
from (select orderid,min(cast(takeofftime as bigint)) as takeofftime,max(cast(arrivaltime as bigint)) as arrivaltime
from fltorderdb..O_Flight
group by orderid) as f)
as zf inner join fltorderdb..O_Flight as f1 on zf.orderid=f1.orderid
inner join fltorderdb..O_Flight as f2 on zf.orderid=f2.orderid
inner join fltproductdb..city as dcity1 on dcity1.city=f1.dcity
inner join fltproductdb..city as acity1 on acity1.city=f2.acity
where f1.takeofftime=zf.takeofftime and f2.arrivaltime=zf.arrivaltime) as second
on first.orderid=second.orderid
inner join fltorderdb..o_orders as o on o.orderid=first.orderid
left join (select ofe1.orderid,stuff((select ',' + SaleType
from fltorderdb..O_FlightExtend where orderid = ofe1.orderid for xml path('') ), 1, 1, '' ) as SaleType
from fltorderdb..O_FlightExtend as ofe1
group by ofe1.orderid) as ofe on ofe.orderid=o.orderid
left join (select fiop1.orderid,stuff((select ',' + OwnerAirline
from fltorderdb..FltIntlOrderPolicy where orderid = fiop1.orderid for xml path('') ), 1, 1, '' ) as OwnerAirline
from fltorderdb..FltIntlOrderPolicy as fiop1
group by fiop1.orderid) as fiop on fiop.orderid=o.orderid