在查询分析器中执行正确,但是获取DataSet出错
金蝶云社区-ebbbbon
ebbbbon
0人赞赏了该文章 2,349次浏览 未经作者许可,禁止转载编辑于2015年08月26日 15:05:13

select isnull((select sum(FXsJine) from V_ST_NewMonthData t0 where exists(select 1 from V_ST_EmpCust t1 where t0.FCustID=t1.Fcustid and t1.Fywyid='145365')
and datediff(s,'2015-04-01 00:00:00',convert(varchar(20),t0.FYear)+'-'+convert(varchar(20),t0.FMonth)+'-1')>0 and datediff(s,dateadd(s,-1,dateadd(m,1,(convert(varchar(20),t0.FYear)+'-'+convert(varchar(20),t0.FMonth)+'-1'))),'2015-05-31 23:59:59')>=0 and t0.FDeptID=100046),0)

结果
无列名
1322047.4700000000

提示错
parse error. detail message is :
Error. additive operator can not use add Char Or NChar
source sql is :

select isnull((select sum(FXsJine) from V_ST_NewMonthData t0 where exists(select 1 from V_ST_EmpCust t1 where t0.FCustID=t1.Fcustid and t1.Fywyid='145365')
and datediff(s,'2015-04-01 00:00:00',convert(varchar(20),t0.FYear)+'-'+convert(varchar(20),t0.FMonth)+'-1')>0 and datediff(s,dateadd(s,-1,dateadd(m,1,(convert(varchar(20),t0.FYear)+'-'+convert(varchar(20),t0.FMonth)+'-1'))),'2015-05-31 23:59:59')>=0 and t0.FDeptID=100046),0)