q8090987 2016-05-13 12:46 采纳率: 0%
浏览 1343
已结题

sqlserver的异常报错求指导!

各位大神,我跑下面这段代码的时候一直报如下错误:
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

  • 写回答

2条回答 默认 最新

  • ljheee 2016-05-13 13:25
    关注

    是 给日期字段,赋值时,参数不对吧

    评论

报告相同问题?

悬赏问题

  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
  • ¥30 3天&7天&&15天&销量如何统计同一行
  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能