一 Oracle 循环插入测试数据 declare maxrecords constant int:=1000; i int :=1; begin for i in 1..maxrecords loop insert into UserInfo(UserID,login,password,firstName,lastName,ISADMINISTRATOR) values(SYS_GUID(),TO_CHAR('9999'+i),'password','fri…
创建随机字符串函数,便于创建名称 DROP function if EXISTS rand_string; #创建一个指定字符个数的函数 create function rand_string(n INT) #返回字符串,注意:此处关键字是returns 而不是return returns varchar(255) BEGIN #定义一个临时变量,给变量赋值'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' DECLARE chars_s…
SqlServer循环语句 declare @i int set @i =1 while(@i<5) begin set @i = @i+1 insert into text(id,name) values('1','王麻子') end SqlServer批量倒数据 如果两张表字段相同的话: insert into text1 select * from text如果两张表字段不同的话: insert into text1(fid,fname,fage...) select fid,fnam…
http://blog.51cto.com/tianxingzhe/1676097 DROP PROCEDURE test_insert ; DELIMITER $$ CREATE PROCEDURE test_insert() BEGIN DECLARE i INT DEFAULT 0; START TRANSACTION; WHILE i<10000000 DO insert into big_table( field01, field02, field03) SELECT FLOOR(RA…