文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>T-SQL批量添加指定记录3种方法

T-SQL批量添加指定记录3种方法

时间:2010-09-28  来源:Wind·e

T-SQL批量添加指定记录3种方法

 

方法一:使用insert into...values...

复制内容到剪贴板 程序代码 create table #s(id int identity(1,1) primary key,name nvarchar(20),age int)
--批量添加
insert into #s(name,age) values('stu1',20)
insert into #s(name,age) values('stu2',21)
insert into #s(name,age) values('stu3',22)
insert into #s(name,age) values('stu4',23)
insert into #s(name,age) values('stu5',24)
select * from #s
drop table #s

方法二:使用insert into...select...

复制内容到剪贴板 程序代码 create table #s(id int identity(1,1) primary key,name nvarchar(20),age int)
--批量添加
insert into #s(name,age) select 'stu1',20
insert into #s(name,age) select 'stu2',21
insert into #s(name,age) select 'stu3',22
insert into #s(name,age) select 'stu4',23
insert into #s(name,age) select 'stu5',24
select * from #s
drop table #s

方法三:使用insert into...select...union all...

复制内容到剪贴板 程序代码 create table #s(id int identity(1,1) primary key,name nvarchar(20),age int)
--批量添加
insert into #s(name,age) select 'stu1',20
union all select 'stu2',21
union all select 'stu3',22
union all select 'stu4',23
union all select 'stu5',24
select * from #s
drop table #s
相关阅读 更多 +
排行榜 更多 +
方块枪战战场安卓版

方块枪战战场安卓版

飞行射击 下载
战斗火力射击安卓版

战斗火力射击安卓版

飞行射击 下载
空中防御战安卓版

空中防御战安卓版

飞行射击 下载