mssql 一次向表中插入多条数据的方法分享 (转自:http://www.maomao365.com/?p=6058)

转自:http://www.maomao365.com/?p=6058)

<span style=”font-size:16px;font-weight:bold;”>
摘要:
在mssql中,一条sql语句默认为一个事务,下文展示如何在一条sql语句中,插入多行数据
</span>
<hr />
例:
 

create table test (keyId int identity,info varchar(10))
go
insert into test(info) values('a'),('b'),('ac'),('ad'),('e')
----采用在每个插入的value后面加入一个逗号
go
select * from test 
go
truncate table test 
drop table test 

 

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

相关推荐