SQL Server得到新插入数据的自增ID
程序员文章站
2022-06-05 09:28:50
...
sql server下实现插入数据后能够得到新插入数据的id
<selectKey keyProperty="id" order="AFTER" resultType="long">
select @@IDENTITY as id
</selectKey>
insert into LJMeasureProcessPoint
(mpid, housename, pointposition, typeid)
values (#{mpID},#{HouseName},#{pointPosition},#{TypeID})
</insert>
mysql
SELECT LAST_INSERT_ID()
转载于:https://www.jianshu.com/p/5c483bc7d349