mysql insert or update

INSERT INTO vtm_addressinfo(UserId,AcceptUser,AcceptTel,AcceptLocation,Email,CreateTime)
VALUES(@UserId,@AcceptUser,@AcceptTel,@AcceptLocation,@Email,@CreateTime)
ON DUPLICATE KEY UPDATE
UserId=@UserId,AcceptUser=@AcceptUser,AcceptTel=@AcceptTel,AcceptLocation=@AcceptLocation,Email=@Email,ModifyTime=@ModifyTime

  

UserId唯一约束

insert 失败后会update

索引自增断号问题
posted @ 2020-04-15 18:03  yufeiyunsui  阅读(1384)  评论(0编辑  收藏  举报