自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

SQL Server數(shù)據(jù)庫自增字段正確的插入值的描述

數(shù)據(jù)庫 SQL Server
以下的文章主要向大家講述的是SQL Server數(shù)據(jù)庫之向SQL Server自增字段正確的插入值的實際操作流程,以下就是文章的主要內(nèi)容描述。

我們今天主要向大家講述的是SQL Server數(shù)據(jù)庫之向SQL Server自增字段正確的插入值的實際操作步驟,在一般的情況下,我們不能向 SQL Server 數(shù)據(jù)庫自增字段中插入值,如果非要這么干的話,SQL Server 就會好不客氣地給你個錯誤警告:

  1. Server: Msg 544, Level 16, State 1, Line 1  
  2. Cannot insert explicit value for identity column in table 't' when identity_insert is set to OFF. 

這個錯誤消息提示我們,如果向 SQL Server 數(shù)據(jù)庫自增字段插入值,需要設(shè)置 identity_insert 選項為 on。

  1. set identity_insert on 

看具體的一個例子:

 

  1. create table dbo.t  
  2. (  
  3. id int identity(1,1) not null,  
  4. name varchar(50)  
  5. )  
  6. set identity_insert t on  
  7. insert into t (id, name) values(1, 'sqlstudy')  
  8. set identity_insert t off  

注意的是,自增字段插入值后,要及時把 identity_insert 設(shè)置為 off。
 

上述的相關(guān)內(nèi)容就是對SQL Server數(shù)據(jù)庫之向SQL Server自增字段插入值的描述,希望會給你帶來一些幫助在此方面。

【編輯推薦】

  1. MS SQL Server 連接字符串的實際操作簡介
  2. SQL Server 字符串在實際操作中的注意事項
  3. SQL Server 連接字符串的一些聲明
  4. 鏈接SQL Server數(shù)據(jù)庫中的字符串經(jīng)驗總結(jié)
  5. SQL Server 連接字符串的實現(xiàn)步驟
責(zé)任編輯:佚名 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-06-28 09:59:47

SQL Server自

2010-07-09 12:49:41

SQL Server自

2010-10-20 10:04:36

sql server自

2010-09-28 16:14:14

SQL Server自

2010-07-07 10:31:43

SQL Server數(shù)

2010-07-05 13:29:56

2010-05-31 11:34:00

MySQL自增字段

2010-07-01 16:52:53

SQL Server數(shù)

2010-06-30 11:16:50

SQL Server

2011-08-18 18:34:00

Oracle數(shù)據(jù)庫創(chuàng)建自增字段

2024-10-08 15:31:45

2010-07-05 13:36:21

SQL Server

2010-07-01 15:02:29

SQL Server數(shù)

2010-04-09 10:32:03

Oracle 數(shù)據(jù)庫

2010-07-05 12:33:13

SQL Server

2010-06-28 16:36:13

SQL Server

2010-08-31 08:38:55

SQL Server

2010-07-01 11:14:36

SQL Server

2010-07-07 14:17:43

SQL Server數(shù)

2010-07-01 11:03:04

SQL Server轉(zhuǎn)
點贊
收藏

51CTO技術(shù)棧公眾號