---
title: "ibatis insert 返回自增主键"
author: "sprite311"
date: "2015-01-26T17:35:43Z"
tags: []
categories: ["编程语言"]
slug: "ibatis-insert"
draft: false
lastmod: "2015-01-26T17:35:43Z"
id: 2180171
url: "https://sprite311.iteye.com/blog/2180171"
---

英文描述：how ibatis  return the auto increment primary key when insert.

 

详细解决办法在这里，我验证过，是可用的：

http://snowolf.iteye.com/blog/215571

 

但是看了解决办法后，我不明白@@IDENTITY 以及 SCOPE\_IDENTITY()是什么意思。

所以又搜索了一下：

http://stackoverflow.com/questions/481395/t-sql-identity-scope-identity-output-and-other-methods-of-retrieving-last

 

http://stackoverflow.com/questions/10294122/select-last-insert-id

 

http://stackoverflow.com/questions/1920558/what-is-the-difference-between-scope-identity-identity-identity-and-ide