1建立数据表
class="code_img_closed" src="/Upload/Images/2014111110/0015B68B3C38AA5B.gif" alt="" />logs_code_hide('7f47bcc3-4060-4b18-8081-87f4b540f8aa',event)" src="/Upload/Images/2014111110/2B1B950FA3DF188F.gif" alt="" />create table projectManage ( ID int identity primary key not null, projectName nvarchar(20)not null, manager_1 nvarchar(10) not null, manager_2 nvarchar(10) not null, monitor nvarchar(10) not null, isFire varchar(2) null , startTime datetime not null, endTime datetime not null, manager_1tel nvarchar(11) not null, manager_1company nvarchar(20) not null, manager_2tel nvarchar(11) not null, manager_2company nvarchar(20) not null, monitortel nvarchar(11) not null, monitorcompany nvarchar(20) not null ) select *from projectManage insert projectManage values('装机','小明','大明','工程监理','是','1990-9-9','2000-9-9','13527748096','13527748096','13527748096','13527748096','13527748096','13527748096')View Code
2利用while循环每五秒插入一条数据
declare @dt datetime,@today datetime,@a varchar(max),@z datetime set @a=0 select @today=CONVERT(varchar(100), GETDATE(), 20),@dt=@today while @a<1 begin select @today=CONVERT(varchar(100), GETDATE(), 20) while @dt=@today begin insert projectManage values('装机bb'+@a,'小明','大明','工程监理','是',@dt,'2000-9-9','13527748096','13527748096','13527748096','13527748096','13527748096','13527748096') set @dt=DATEADD(SECOND,5,@dt) end set @a=@a-1 endView Code
3一次插入N条数据
adb-841e-b75e5b5d52cd" class="code_img_closed" src="/Upload/Images/2014111110/0015B68B3C38AA5B.gif" alt="" />declare @i varchar(max) set @i=1 while @i<1000001 begin insert projectManage values('装机'+@i,'小明','大明','工程监理','是','1990-9-9','2000-9-9','13527748096','13527748096','13527748096','13527748096','13527748096','13527748096') set @i=@i+1 endView Code