SQL Server得到新插入数据的自增ID
2019-05-21 本文已影响0人
dwwl
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()