CREATE PROCEDURE insertrecord
(
@roomid int
)
AS
declare @mRemain money
select @mRemain=sum(remain) from Payment where [email protected]
。。。。。
[email protected]=sum(remain)中等号有错误,请高手指点
------解决方案--------------------
sum是数字型的,[email protected]
------解决方案--------------------
select @mRemain=CAST(sum(remain) AS MONEY) from Payment where [email protected]
不知道这样可以了没
------解决方案--------------------
--我的测试代码没有问题呀.
create table #
(
月份 varchar(6) ,
实发工资 numeric(18,2)
)
insert into #
select '200701 ',7889.34 union all
select '200701 ',897.23 union all
select '200702 ',565.34 union all
select '200701 ',1234.23
alter PROCEDURE insertrecord
(
@roomid varchar(7)
)
AS
declare @mRemain money
select @mRemain=sum(实发工资) from # where [email protected]
select @mRemain
exec insertrecord '200701 '
------解决方案--------------------
结果:
10020.8000
(所影响的行数为 1 行)
------解决方案--------------------
语法无错误,检查remain的数据类型。