All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
比较测试PHP+MYSQL分页机制两种方案_php资料_编程技术
一个无刷新效果定时自动更新页面的例子_.net资料_编程技术
操作数据:中级SQL_mssql学习_编程技术
visual c++中虚基类的用法
ASP.NET,2.0程序安全的基础知识_.net资料_编程技术
总结经验技巧文章:C#.NET函数和方法集_.net资料_编程技术
PHP程序加速探索之代码优化_[PHP教程]
XML入门教程-验证XML是合法的XML_[XML教程]
asp.net2.0内置Response对象的属性
实例学习PHP如何实现在线发邮件_php资料_编程技术
Reading number is top 10 pictures
西班牙山村小景1
Beauty ZhiHuiLin2
The money of more than 100 countries and regions10
The real super beauty5
两张抽象画
Sexy women in 2013--2
史上最大的哺乳动物迁移
Fury xp desktop theme
Ashlynn Brooke a group sexy photo1
The money of more than 100 countries and regions20
Download software ranking
网络管理员第三版
WebService在.NET中的实战应用教学视频 → 第2集
Boxer's Top ten classic battle3
Twenty piece of palm leaf
C#编程思想
Sora aoi - one of more PK
虚拟机5.5.3版
Wild things 2
Popkart Cracked versions Mobile phone games
功夫熊猫2(上集)
归海一刀 published in(发表于) 2014/2/1 0:22:57 Edit(编辑)
用SQL批量插入数据_[SQL,Server教程]

用SQL批量插入数据_[SQL,Server教程]

用SQL批量插入数据_[SQL Server教程]

最近忙于公司BI软件性能测试,这几天主要测试CUBE采用ROLAP下,PA的并发和稳定性。涉及表和维度,立方:事实表sales_fact_1997,维度表time_by_day;立方:sales 修改内容:删除原来的TIME维度,新建TIME维度,修改SALES立方。

  数据插入:


  1,事实数据插入:通过DTS加调度实现将sales_fact_1997的数据进行复制。频率为每分钟10000条。


  主要用到的SQL语句:select top 10000 * from sales_fact_1997


  2,维度数据插入:通过SQL语句插入数据到time_by_day.


  测试用到的SQL语句:


  1,单条插入


INSERT INTO time_by_day
(time_id, the_date, the_year, month_of_year, quarter,day_of_month)
VALUES ('1101', '1999-10-1', '1999', '10', 'Q4','1')


  2,单条插入:


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


  3,循环插入:


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


  4,插入以时间为变量的数据


DECLARE @MyCounter INT
declare @the_date datetime
SET @MyCounter = 0
SET @the_date = '1999-1-4'
WHILE (@MyCounter < 200000)
BEGIN
WAITFOR DELAY '000:00: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
*/
insert into time_by_day (time_id,the_date)values('371',@the_date)
SET @the_date = @the_date + 1
SET @MyCounter = @MyCounter + 1
END


作者:曾进
来源:网络





添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.