存储过程循环插入数据
代码
Declare @Count int;
declare @MaxCount int;
declare @id tinyint;
declare @name char(40);
declare @order int;
declare @dataname char(40);
declare @tmp char(40);
set @Count = 105;
set @MaxCount = 255;
set @id = 30;
set @name = 'TEST用'
set @order = 5;
set @dataname = 'サークル紹介Test';
while (@Count < @MaxCount)
Begin
set @Count = @Count + 1;
set @order = @order + 1;
set @dataname = @dataname;
INSERT INTO [DB].[dbo].[CM]
([id]
,[name]
,[data_id]
,[data_name]
,[sys_kind]
,[status]
,[insert_date]
,[update_date]
,[update_user_id]
,[update_user_name]
,[order]
,[explanation]
,[fix_flag])
VALUES
(@id,@name,@Count,
@dataname,1,'true',getdate(),getdate(),
'0000101', 'test1',@order,'','1')
END