Strange SQL SERVER Query Error

spring_ok 2003-08-28 11:36:11
Update Proposals set ProposalName = '111111111'
from proposals Where proposalautoid in (248, 267, 271, 869, 880)


Error:
Server: Msg 512, Level 16, State 1, Procedure AutoSetDataTime, Line 5
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.

ProposalAutoID is a Identity field.It is also the PK field.

How to work around it?
...全文
107 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
spring_ok 2003-09-04
  • 打赏
  • 举报
回复
没错。后来发现是另一个程序员使用了一个触发器.但他的触发器未考虑到一次更新多条记录时的情况。
spring_ok 2003-08-28
  • 打赏
  • 举报
回复
Update Proposals set ProposalName = '111111111'
Where proposalautoid < 1000

Also report this error.
spring_ok 2003-08-28
  • 打赏
  • 举报
回复
The same error.

My initial query is like yours.
CrazyFor 2003-08-28
  • 打赏
  • 举报
回复
Update Proposals set ProposalName = '111111111'
Where proposalautoid in (248, 267, 271, 869, 880)
txlicenhe 2003-08-28
  • 打赏
  • 举报
回复
触发器中调用了这个:
AutoSetDataTime
happydreamer 2003-08-28
  • 打赏
  • 举报
回复
-----禁用触发器
alter table 表名 disable trigger 触发器名
pengdali 2003-08-28
  • 打赏
  • 举报
回复
如果有触发器,请改为下面的形式:

CREATE TRIGGER trname ON Proposals
FOR update
AS
update YouTable set ProposalName=tem.ProposalName from inserted tem where YouTable.proposalautoid=tem.proposalautoid
go
pengdali 2003-08-28
  • 打赏
  • 举报
回复
你有触发器吗?
估计是你的for update触发器所引起的。

34,594

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧