|
这样的存储过程,在平台中调用时出如下错误,
declare @fupDiscount decimal(18,2) --上月折扣余额
declare @fDiscount decimal(18,2) --本月折扣金额
declare @fDiscount_db decimal(18,2) --本月调拨
declare @fDiscount_us decimal(18,2) --本月报销
declare @fgsname varchar(20)
select @fgsname=FDISPLAYNAME from opendatasource('sqloledb','data source=192.168.0.250;user id=saassword=perfect').perfect_system.dbo.TDEPT where EBH = @fgsno
--select name from newshop..fgs where fgsno=@fgsno
--取上月份
select @month=max(fcmonth) from Bservice_flag
--取上月折扣余额
select @fupDiscount=isnull(fDiscount,0) from Bservice_yj where fcmonth=@month and fgsno=@fgsno and fwgsbh=@fwgsbh
---取本月折扣金额
select @fDiscount=isnull(sum(fcash),0) from Bservice_zk where fcmonth=@fcmonth and fgsno=@fgsno and fwgsbh=@fwgsbh
---取本月调拨
select @fDiscount_db=isnull(sum(fcash),0) from Bservice_db where fcmonth=@fcmonth and fgsno=@fgsno and fwgsbh=@fwgsbh
---取本月报销
select @fDiscount_us=isnull(sum(b.JE),0) from opendatasource('sqloledb','data source=192.168.0.250;user id=saassword=perfect').ywbx.dbo.FWGSBXZB a, opendatasource('sqloledb','data source=192.168.0.250;user id=saassword=perfect').ywbx.dbo.FWGSMXB b where a.SQBH = b.SQBH and a.LZBZ = 1 and a.BXYF = @fcmonth and b.FWGSBH=@fwgsbh and a.SQBM =@fgsname
--返回可报销折扣(动态计算:上月折扣余额+本月折扣金额+本月调拨-本月报销)
select @discount=@fupDiscount+@fDiscount+@fDiscount_db-@fDiscount_us
GO
|
-
-
2.jpg
126.11 KB, 下载次数: 134
|