子查询返回了 1 个以上的值。 (在 while 循环中插入)
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
出于测试目的尝试插入但与子查询堆叠在第 9 行返回了超过 1 个值错误。
有什么想法吗?
此致
由于您的 SQL 中似乎没有任何子查询,请检查 [watersave] table.
上是否有任何触发器
参考:
SQL Server Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >=
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
出于测试目的尝试插入但与子查询堆叠在第 9 行返回了超过 1 个值错误。
有什么想法吗? 此致
由于您的 SQL 中似乎没有任何子查询,请检查 [watersave] table.
上是否有任何触发器参考: SQL Server Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >=