数据库中插入10W条数据

这里列出一些数据库中插入10W条数据的代码:

1.sqlserver:

declare @i int
set @i = 1
while (@i<=50000)
begin
insert into t_brushCardHistory (iCardID,iCardTypeID,icard_head,iCardNO,iHostID,sHostAdd,tBrushTime)VALUES(2,1,0,1407062791,2,'主门口机',dateadd(minute,@i,getdate()))
set @i= @i +1
end


2.mysql(有点特殊,需要先创建一个存储过程,然后再调用):

DROP PROCEDURE if exists dowhile;
--
create PROCEDURE dowhile()
BEGIN
DECLARE i int DEFAULT 0;
START TRANSACTION;
WHILE i<100000 DO
insert into `TNt_telephone` (TNc_agencyName,TNc_phone,TNc_telePhoneOperator,TNc_operatTime,TNc_remark)VALUES(i,13380389053,'admin',now(),CONCAT('...阿狸',i));
set i=i+1;
END WHILE;
COMMIT;
END
--
call dowhile();


3.oracle等待更新:

4.DB2等待更新:
展开阅读全文

没有更多推荐了,返回首页