sql Set IDENTITY_INSERT的用法

语法
set identity_insert [ database.[ owner.] ] { table } { on | off }

参数
database ,是指定的表所驻留的数据库名称。

owner

是表所有者的名称。

table

是含有标识列的表名。

使用举例子,往数据库中插入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

(0)
上一篇 2022年3月21日
下一篇 2022年3月21日

相关推荐