0
DECLARE @int int 
DECLARE @saveamount int 
DECLARE @savedate datetime 
SET @int=1 
SET @saveamount=400 
SET @savedate= '20160101 13:00:00.00' 
WHILE @int<=357 
BEGIN 
INSERT INTO watersave (reservoirid, amount, savedate) 
      VALUES (1,@saveamount,@savedate) 


SET @[email protected]+1 
SET @[email protected]+(SELECT ROUND((6 - 12 * RAND()), 0)) 
SET @[email protected]+1 
END 

试图插入用于测试目的,但层叠子查询返回上线9子查询返回的值超过1。 (while循环内插入)

任何想法超过1个值错误? Regards

+0

是不是该查询返回多个值? SELECT ROUND((6 - 12 * RAND()),0) – tobypls

+0

由于seagulledge指出,问题是由于触发。我需要更新触发器中的子查询。 –

回答

相关问题