zoukankan      html  css  js  c++  java
  • sql每五秒插入一条数据 一次插入N条数据

    1建立数据表

    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
    end
    View Code

    3一次插入N条数据

    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
    end
    View Code
  • 相关阅读:
    工业以太网的现状与发展
    软件开发的7大原则
    white-space
    vue使用better-scroll做轮播图(1.X版本 比较简单)
    windows 查看端口占用
    使用通知notication pendingIntent 传递参数
    fragment 创建optionsmenu
    android viewmodel 带参数
    LifecycleObserver 生命周期检测
    过河问题
  • 原文地址:https://www.cnblogs.com/weivvei/p/4087754.html
Copyright © 2011-2022 走看看