SQL Server 開啟或關閉自增長

2022-09-21 16:24:13 字數 478 閱讀 6330

在往資料庫表中新增一行的時候,要針對自增列插入乙個特定值的時候,這個函式就很有用了,比如表結構如:

id |  www.cppcns.comtext

1  |    a

2&www.cppcns.comnbsp; |    b

4  |  程式設計客棧 d

其中id列是自曾列,如果我們要插入3  |  c的話,如果沒有開啟自增列,肯定是插不進去的,這時程式設計客棧候用這個函式就有作用了

複製** **如下:

set identity_insert [recursive] on

insert into [recursive](id,text) values(3,'c')

set identity_insert [recursive] off

通常我們在匯入資料的時候會用到這種方法,希望程式設計客棧對大家有所幫助。

本文標題: sql server 開啟或關閉自增長

本文位址:

contos firewalld 開啟或關閉埠

1 firewalld的基本使用 啟動 systemctl start firewalld 檢視狀態 systemctl status firewalld 停止 systemctl disable firewalld 禁用 systemctl stop firewalld2.systemctl是ce...

如何開啟或關閉SELinux

centos的 etc sysconfig selinux 修改檔案 etc sysconfig selinux this file controls the state of selinux on the system.selinux can take one of these three val...

Sql server 中關閉自增字段

今天有同事問我乙個關於 sql server自增字段值如何關閉自增,手動修改自增id的問題。以前經常使用這樣的sql 語句,但一時又想不起來,在幫助裡找了半天。唉 看來人真的老了,啥都記不起。高中的時候數學老師經常愛講這樣一句話 好記性不如亂筆頭 越來越感覺到這句話太對了 以後要勤記,多記,好好記。...