MSDN 說明
您可以將包含識別值的資料檔案大量匯入 Microsoft SQL Server 的執行個體中。 根據預設,會忽略所匯入資料檔案中的識別欄位值, SQL Server 會自動指定唯一值。 唯一值的依據是資料表建立期間所指定的初始值及累加值。
測試 KeepIdentity 效果
建立測試資料 Identity 為 1、3、5 三筆奇數資料,並分別利用 Bulk Insert 匯入資料
- 左圖:指定 KeepIdentity,identity 仍為 1、3、5
- 右圖:預設為沒有指定 KeepIdentity,identity 會自動產生
![[SQL] 大量匯入與 Identity](https://live.staticflickr.com/65535/48019254003_66e1fa4c2b_z.jpg)
![[SQL] 大量匯入與 Identity-2](https://live.staticflickr.com/65535/48019373113_78d66e706b_z.jpg)
沒有留言:
張貼留言