Home > Database > Mysql Tutorial > sql Set IDENTITY_INSERT的用法

sql Set IDENTITY_INSERT的用法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:57:42
Original
1332 people have browsed it

SET IDENTITY_INSERT 允许将显式值插入表的标识列中。

SET IDENTITY_INSERT [ database.[ owner.] ] { table } { ON | OFF }


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


是表所有者的名称。


是含有标识列的表名。

使用举例子,往数据库中插入100万条记录。
代码如下:
set identity_insert sosuo8database on
declare @count int
set @count=1
while @countbegin
insert into sosuo8database(id,userName,userPWD,userEmail) values(@count,'ahuinan','ahuinan','sosuo8.com') set @count=@count+1
end
set identity_insert sosuo8database off
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
sql file
From 1970-01-01 08:00:00
0
0
0
php - Overhead of prepare vs sql?
From 1970-01-01 08:00:00
0
0
0
Print sql statement
From 1970-01-01 08:00:00
0
0
0
Pass array to SQL insert query using PHP
From 1970-01-01 08:00:00
0
0
0
sql optimization or
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template