1
我有一个具有1行 表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
不,“更新”从不创建新记录。一个'insert'就行了。 –
检查存储过程或者表中是否有触发器。 – DavidG
你可以显示存储过程的定义吗? –