sql Set IDENTITY_INSERT的用法
發(fā)布日期:2022-02-02 13:46 | 文章來源:站長之家
語法
SET IDENTITY_INSERT [ database.[ owner.] ] { table } { ON | OFF } 參數(shù)
database ,是指定的表所駐留的數(shù)據(jù)庫名稱。 owner
是表所有者的名稱。 table
是含有標(biāo)識(shí)列的表名。 使用舉例子,往數(shù)據(jù)庫中插入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ù)據(jù)庫名稱。 owner
是表所有者的名稱。 table
是含有標(biāo)識(shí)列的表名。 使用舉例子,往數(shù)據(jù)庫中插入100萬條記錄。
復(fù)制代碼 代碼如下:
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
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。
相關(guān)文章