SqlServer 插入多條資料

2021-09-30 15:27:45 字數 862 閱讀 9389

--插入一條資料使用default關鍵字

insert into student(studentno,loginpwd,studentname,***,gradeid,phone,address,borndate,email)

values('001','12345','張三','男',1,'1234567890123',default,'2012-10-01','[email protected]')

--插入多條資料使用default關鍵字(第一種方法)

insert into student(studentno,loginpwd,studentname,***,gradeid,phone,address,borndate,email)

values('002','12345','李四','男',1,'1234567890123',default,'2012-10-01','[email protected]'),

('003','12345','王五','男',1,'1234567890123',default,'2012-10-01','[email protected]')

--插入多條資料使用default關鍵字(第二種方法,不要將預設列名寫出,在union後面加上all,最後一行不加)

insert into student(studentno,loginpwd,studentname,***,gradeid,phone,borndate,email)

select '004','12345','馬六','男',1,'1234567890123','2012-10-01','[email protected]' union all

select '005','12345','杜七','男',1,'1234567890123','2012-10-01','[email protected]'

SQL表單條資料插入與多條資料插入

建立使用者表 create table users uid int identity 1,1 not null,uname varchar 20 not null,upassword varchar 20 not null,uage int,u bit default 0 not null,sele...

Oracle中插入多條資料

1 oracle中 insert into product id,names,price,code select 100,a 1,1 from dual union select 101,b 2,2 from dual 這裡最好用一次insert,不然效率不高,用多個select.2 mysql中 ...

MySQL批量插入多條資料

mysql在插入大量資料 十萬級或者百萬級別 時效率會變得很差,所以需要採用以下方法來提高其插入效率。a 關閉自動提交,改為手動提交 connect.setautocommit false 插入資料完後最後再con.commit b 拆分資料,多執行緒入庫 c 一條插入語句插入多條資料 insert...