![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SQL
白桃気泡水
这个作者很懒,什么都没留下…
展开
-
sql server自增主键变为非自增,sequence控制id值
之前使用的表的主键为id自增,现在想变成由sequence来控制id值的增加,不能删除现有数据,数据一直保持在数据库中。之前的schema:create table biz_job_history ( id BIGINT identity not null , job_id VARCHAR(32) , start_time DATETIME2 , end_time DATETIME2 , status VARCHAR(32) , result NVARCHAR(max)原创 2021-11-19 15:34:06 · 1667 阅读 · 0 评论 -
获取自增主键 insert新增数据之后的值
自增表新插一条数据后,获取插入数据的id:mapper.xml<select id="selectIdentity" resultType="java.lang.Long"> SELECT @@identity </select>mapper.javaLong selectIdentity();代码中insert后直接调用即可获取刚才插入数据的idLong id = jobHistoryMapper.selectIdentity(原创 2021-11-19 15:13:33 · 180 阅读 · 0 评论