我有一个存储过程来更新我的表数据。
update tbl_duty
set Name = @DName,
Necessity = @DNecessity,
Payment = @DPayment,
[Estimation Time] = @DEstimationTime,
Term = @DTerm,
[Description] = @DDescription
where
Id = "what can I put here"
但我现在不知道如何更新ID
列,因为它自己生成(identity
列)
任何人都可以帮助我?
我们有类似GETIDENTITY(column name)
的内容吗?
答案 0 :(得分:1)
你想要这样的东西吗?
update tbl_duty
set Name = @DName,
Necessity = @DNecessity,
Payment = @DPayment,
[Estimation Time] = @DEstimationTime,
Term = @DTerm,
[Description] = @DDescription
where id = (select max(id) from tbl_duty);
这似乎非常危险。为什么不首先插入具有正确值的记录?