Discuz教程网

用SQL批量插入数据的存储过程

[复制链接]
authicon dly 发表于 2011-9-8 20:20:16 | 显示全部楼层 |阅读模式
循环插入:
  1. DECLARE @MyCounter INT
  2. SET @MyCounter = 0 /*设置变量*/
  3. WHILE (@MyCounter < 2) /*设置循环次数*/
  4. BEGIN
  5. WAITFOR DELAY '000:00:10' /*延迟时间10秒*/
  6. INSERT INTO time_by_day
  7. (time_id, the_date, the_year, month_of_year, quarter, day_of_month)
  8. SELECT TOP 1 time_id + 1 AS time_id, the_date + 1 AS the_date, YEAR(the_date + 1)
  9. AS the_year, MONTH(the_date + 1) AS month_of_year, { fn QUARTER(the_date + 1)
  10. } AS quarter, DAY(the_date + 1) AS day_of_month
  11. FROM time_by_day
  12. ORDER BY time_id DESC
  13. SET @MyCounter = @MyCounter + 1
  14. END
复制代码



上一篇:SmartHTTP 简易HttpRequest类(ASP)
下一篇:asp正则表达式使用详解
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-6-17 15:52

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表