| 發文者 | ycheng |
| 日期 | 2007/10/29 下午 03:39:24 |
| 標題 | Re: 自動編號這種欄位要怎麼使用比較好? |
| Message Id | 4WfALA$Jrd@bbs.sayya.org |
| 內文 |
http://dev.mysql.com/doc/refman/5.0/en/information-functions.html
#function_last-insert-id
The ID that was generated is maintained in the server on a per-connection
basis. This means that the value returned by the function to a given client
is the first AUTO_INCREMENT value generated for most recent statement
affecting an AUTO_INCREMENT column by that client.
誰實驗一下吧 ^_%
※ 引述《Lman (梁楓)》之銘言:
> > 自動編號欄位是很危險的欄位
> > 可以使用select IDENT_CURRENT來取得即將產生的值
> > 但是試想若是在你完成之前有另外的程序做了新增的動作
> > 你得到的就是錯誤的值
> > 所以若是在多機環境中確保不會衝突的狀態
> > 建議用後端的程序來做insert
> > 單機或是使用頻率不常的表單才可以冒險用一下
> lock table write
--
[1;32m※ Origin: [33mSayYA 資訊站 [37m |
.Net 原始碼 | ASP.NET News Reader Beta 0.2.9
個人資料 |
發表新文章 |
回覆 |
回信 |
轉寄 |
同標題 | 搜尋
| 列印
預覽
直接
2007/06/21 由於微軟新聞伺服器移除多數新聞群組 (newsgroup),目前遭移除之群組暫時改為隱藏純瀏覽,若狀況已定案時,將會將隱藏中的群組重新調整。[討論]