以下是我定义的几个变量,[email protected]?
- SQL code
declare @box2persent float declare @box3persent float declare @box4persent float declare @box2realsentcount int declare @box3realsentcount int declare @box4realsentcount int declare @totalpersent int set @box2persent=40 set @box3persent=50 set @box4persent=90 set @totalpersent=0 select @box2realsentcount=realsendcount from @result where servertype=130 select @box3realsentcount=realsendcount from @result where servertype=131 select @box4realsentcount=realsendcount from @result where servertype=216 set @[email protected][email protected]/100 set @[email protected][email protected]/100 set @[email protected][email protected]/100 set @[email protected][email protected][email protected] print @totalpersent print @box2realsentcount print @box3realsentcount print isnull(@box4realsentcount,0)结果: (2 row(s) affected)(1 row(s) affected)(2 row(s) affected) 364836960
[email protected]?
很费解。。
------解决方案--------------------
没看出啥问题啊
------解决方案--------------------
set @[email protected][email protected][email protected]
可能是这里面某个变量的值为null,相加后的结果为null,所以print出来没有东西
像下面这样也是
declare @i int
select @i=1+null
print @i
------解决方案--------------------
+1
------解决方案--------------------
------解决方案--------------------
set @[email protected][email protected][email protected]
确定上面几个变量的值不为空?也就是全都不是null?