sql哪里语法错误
DECLARE @px int
DECLARE @n money
SET @px=0
SET @n=0
UPDATE #12 SET ndhsl=CONVERT(int,ndhsl/ntpbzl)*ntpbzl+ntpbzl
WHERE px=1
WHILE @px<20
BEGIN
SET @px=@px+1
SET @n='select ntpbzl-((ndhsl- '+@n+' )%ntpbzl) from #12 WHERE px= '+@PX+' '''
UPDATE #12 SET ndhsl=CONVERT(int,ndhsl-@n/ntpbzl)*ntpbzl+ntpbzl
WHERE px=@px+1
end
提示消息 235,级别 16,状态 0,第 10 行
无法将 char 值转换为 money。该 char 值的语法有误。
请问哪错了怎么改
------解决方案--------------------DECLARE @px int
DECLARE @n money
SET @px=0
SET @n=0
UPDATE #12 SET ndhsl=CONVERT(int,ndhsl/ntpbzl)*ntpbzl+ntpbzl
WHERE px=1
WHILE @px<20
BEGIN
SET @px=@px+1
select @n=ntpbzl-((ndhsl- @n )%ntpbzl) from #12 WHERE px= @PX
UPDATE #12 SET ndhsl=CONVERT(int,ndhsl-@n/ntpbzl)*ntpbzl+ntpbzl
WHERE px=@px+1
end