【发布时间】:2015-08-05 23:45:42
【问题描述】:
我有一个有 1 行的表 表一
____________________________________________
id_employee | month| year| score| nbr_month|
____________________________________________
14 | 2 |2015 | 15 | 4 |
____________________________________________
我想更新这一行 所以我创建了我的存储过程
update table 1
set score=10,nbr_month=4
where id_employee=14 and month=2 and year=2015
但是存储过程的执行结果又生成了一行
____________________________________________
id_employee | month| year| score| nbr_month|
____________________________________________
14 | 2 |2015 | 15 | 4 |
14 | 2 |2015 | 10 | 4 |
____________________________________________
请问问题出在哪里? 提前谢谢你。
存储过程是:
ALTER proc [dbo].[update_score]
@id_employee int,
@score int,
@nbr_month int,
@month int,
@year int
as
begin
update table1
set score = @score
,nbr_month = @nbr_month
where id_employee = id_employee
and [month] = @month
and [year] = @year
end
【问题讨论】:
-
不,
update永远不会创建新记录。insert确实如此。 -
检查存储过程或者表上是否有触发器。
-
你能显示存储过程的定义吗?
-
@DavidG 执行存储过程时如何确定触发器是否存在?
标签: sql sql-server sql-server-2008