declare @mmm char(5),@ml0 numeric,@yyy char(10),@j numeric
set @ml0=3000
set @mmm='@ml0'
set @j=round(@mmm/cast(day(dateadd(mm,1,@yyy)-1) as int),2)--日平均金额
print @j_______________________________________________
这样做出错,在将varchar值‘@ml0’转换成INT时出错,请问如何将变量@1
r

解决方案 »

  1.   

    没看明白
    set @ml0=3000 
    set @mmm= '@ml0 ' 
      

  2.   

    declare @mmm char(5),@ml0 numeric,@yyy char(10),@j numeric 
    set @ml0=3000 
    set @mmm=cast(@ml0 as char(5))
    set @j=round(@mmm/cast(day(dateadd(mm,1,@yyy)-1) as int),2)--日平均金额 
    print @j 
      

  3.   

    declare @mmm char(5),@ml0 numeric,@yyy char(10),@j numeric
    set @ml0=3000
    --set @mmm= '@ml0'
    --set @j=round(@mmm/cast(day(dateadd(mm,1,@yyy)-1) as int),2)--日平均金额
    set @j=round(@ml0/day(dateadd(mm,1,@yyy)-1),2)--日平均金额
    print @j
      

  4.   

    我的五笔和SQL,VS经常冲突,软件经常死那