sql - 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 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 insert test purposes stacked subquery returned more 1 value error on line 9.
any idea? regards
since there not appear sub-queries in sql, check see if there triggers on [watersave] table.
reference: sql server subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >=
Comments
Post a Comment