用SQL批量插入数据的代码

时间:2024-01-15 04:49:30 


DECLARE @MyCounter INT
SET @MyCounter = 0 /*设置变量*/
WHILE (@MyCounter < 2) /*设置循环次数*/
BEGIN
WAITFOR DELAY '000:00:10' /*延迟时间10秒*/
INSERT INTO time_by_day
(time_id, the_date, the_year, month_of_year, quarter, day_of_month)
SELECT TOP 1 time_id + 1 AS time_id, the_date + 1 AS the_date, YEAR(the_date + 1)
AS the_year, MONTH(the_date + 1) AS month_of_year, { fn QUARTER(the_date + 1)
} AS quarter, DAY(the_date + 1) AS day_of_month
FROM time_by_day
ORDER BY time_id DESC

SET @MyCounter = @MyCounter + 1
END
标签:SQL,批量插入
0
投稿

猜你喜欢

  • Python格式化输出字符串方法小结【%与format】

    2023-01-06 00:01:50
  • PyTorch device与cuda.device用法介绍

    2022-07-26 23:49:10
  • Python使用淘宝API查询IP归属地功能分享

    2021-02-11 20:37:29
  • Python微服务开发之使用FastAPI构建高效API

    2022-04-20 21:51:13
  • 进一步了解Python中的XML 工具

    2022-06-25 21:49:17
  • python numpy 按行归一化的实例

    2023-04-29 09:14:53
  • DreamWeaver制作会移动的广告条

    2008-02-03 11:34:00
  • JQuery判断radio(单选框)是否选中和获取选中值方法总结

    2024-04-19 10:24:11
  • JavaScript队列的应用实例详解【经典数据结构】

    2024-04-16 09:53:13
  • python模拟登录百度贴吧(百度贴吧登录)实例

    2023-11-20 14:30:56
  • Python实现迷宫自动寻路实例

    2021-12-22 10:00:44
  • 如何在python中判断变量的类型

    2022-05-03 03:35:06
  • vuex中数据持久化插件vuex-persistedstate使用详解

    2024-04-26 17:41:54
  • django 模版关闭转义方式

    2023-07-18 15:23:03
  • Python中Matplotlib的点、线形状、颜色以及绘制散点图

    2023-06-11 00:32:26
  • 深入浅析同源策略和跨域访问

    2024-04-28 09:49:02
  • 快速解决jupyter notebook启动需要密码的问题

    2023-09-27 23:56:49
  • 使用requests库制作Python爬虫

    2023-08-17 21:43:23
  • PyTorch+LSTM实现单变量时间序列预测

    2023-09-23 02:58:05
  • js模拟实现Array的sort方法

    2024-04-10 11:03:22
  • asp之家 网络编程 m.aspxhome.com