Subquery returned more than 1 value. (Insert within a while loop)
问题 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 @int=@int+1 SET @saveamount=@saveamount+(SELECT ROUND((6 - 12 * RAND()), 0)) SET @savedate=@savedate+1 END Trying to insert for test purposes but stacked with the subquery returned more than 1 value error on line 9. Any idea? Regards 回答1: Since