Sql Server中两种批量插入数据的方法

1.循环语句插入
[code]DECLARE @MyCounter INT
SET @MyCounter = 0 /*设置变量*/
WHILE (@MyCounter < 1000) /*设置循环次数*/
BEGIN
insert into t_campaign(t_aspaccount_id, campaign_name) values(939, '测试列表翻页')
SET @MyCounter = @MyCounter + 1
END[/code]

2.子查询插入
[code]insert into t_subcampaign(t_campaign_id, subcampaign_name) ( select t_campaign_id, campaign_name from t_campaign where campaign_name='测试列表翻页')[/code]

你可能感兴趣的:(技术随笔)