当前位置:Gxlcms > 数据库问题 > sql批量插入数据

sql批量插入数据

时间:2021-07-01 10:21:17 帮助过:246人阅读

CREATE PROCEDURE test_insertData (IN n INT) BEGIN DECLARE i INT DEFAULT 1; WHILE (i <= n) DO INSERT INTO websign_gold_ticket(ticket, ticketType, used) VALUES (i, 3002, 1); SET i = i + 1; END WHILE; END $$ delimiter ;

2. 调用存储过程, 插入数据

CALL test_insertData (100) ;

 

SQLServer批量插入数据(未测试):

declare @n int
set @i=1
while @i <= 100
begin
    insert into websign_gold_ticket(ticket, ticketType, used)
    values(i, 3002, 1);
    set i = i + 1;
end while; 

 

sql批量插入数据

标签:code   存在   sed   call   font   set   col   sign   存储过程   

人气教程排行