sql Set IDENTITY_INSERT的用法
更新時間:2009年03月30日 11:35:46 作者:
SET IDENTITY_INSERT 允許將顯式值插入表的標識列中。
語法
SET IDENTITY_INSERT [ database.[ owner.] ] { table } { ON | OFF }
參數(shù)
database ,是指定的表所駐留的數(shù)據庫名稱。
owner
是表所有者的名稱。
table
是含有標識列的表名。
使用舉例子,往數(shù)據庫中插入100萬條記錄。
set identity_insert sosuo8database on
declare @count int
set @count=1
while @count<=1000000
begin
insert into sosuo8database(id,userName,userPWD,userEmail) values(@count,'ahuinan','ahuinan','sosuo8.com') set @count=@count+1
end
set identity_insert sosuo8database off
SET IDENTITY_INSERT [ database.[ owner.] ] { table } { ON | OFF }
參數(shù)
database ,是指定的表所駐留的數(shù)據庫名稱。
owner
是表所有者的名稱。
table
是含有標識列的表名。
使用舉例子,往數(shù)據庫中插入100萬條記錄。
復制代碼 代碼如下:
set identity_insert sosuo8database on
declare @count int
set @count=1
while @count<=1000000
begin
insert into sosuo8database(id,userName,userPWD,userEmail) values(@count,'ahuinan','ahuinan','sosuo8.com') set @count=@count+1
end
set identity_insert sosuo8database off
相關文章
SQL Server中統(tǒng)計每個表行數(shù)的快速方法
這篇文章主要介紹了SQL Server中統(tǒng)計每個表行數(shù)的快速方法,本文不使用傳統(tǒng)的count()函數(shù),因為它比較慢和占用資源,本文講解的是另一種方法,需要的朋友可以參考下2015-02-02
sqlserver中比較一個字符串中是否含含另一個字符串中的一個字符
sql中比較一個字符串中是否含有另一個字符串中的一個字符的實現(xiàn)代碼,需要的朋友可以參考下。2010-09-09
驅動程序無法通過使用安全套接字層(SSL)加密與?SQL?Server?建立安全連接,錯誤:“The?serve
這篇文章主要介紹了驅動程序無法通過使用安全套接字層(SSL)加密與?SQL?Server?建立安全連接,錯誤:“The?server?selected?protocol?version?TLS10?is?not?accepted?by?client,本文給大家介紹的非常詳細,需要的朋友可以參考下2023-03-03

