仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1019|回复: 8
打印 上一主题 下一主题

[学习教程] 一时表

[复制链接]
再现理想 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 14:19:22 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
Memory所有数据置于内存的存储引擎,拥有极高的插入,更新和查询效率。但是会占用和数据量成正比的内存空间。并且其内容会在Mysql重新启动时丢失ALTERproc[dbo].[e_pro_cost]
@typetinyint,
@IsWherenvarchar(1000)
as
begin
ifexists(select*fromtempdb.dbo.sysobjectswhereid=object_id(Ntempdb.dbo.#t_equ_cost))
droptable#t_equ_cost
createtable#t_equ_cost
(
Batchvarchar(50),
eCostPricefloat,
MOIDvarchar(50),
DateDatetime,
PMCPlannervarchar(50),
PMCPlannerNamevarchar(50)
)
insertinto#t_equ_costexece_equ_cost@type
end
--将野生信息存进一时表
begin
ifexists(select*fromtempdb.dbo.sysobjectswhereid=object_id(Ntempdb.dbo.#t_hum_cost))
droptable#t_hum_cost
createtable#t_hum_cost
(
Batchvarchar(50),
hCostPricefloat,
MOIDvarchar(50),
DateDatetime,
PMCPlannervarchar(50),
PMCPlannerNamevarchar(50)
)
insertinto#t_hum_costexece_hum_cost@type
end
begin
ifexists(select*fromtempdb.dbo.sysobjectswhereid=object_id(Ntempdb.dbo.#t_met_cost))
droptable#t_met_cost
createtable#t_met_cost
(
Batchvarchar(50),
mCostPricefloat,
MOIDvarchar(50),
DateDatetime,
PMCPlannervarchar(50),
PMCPlannerNamevarchar(50)
)
insertinto#t_met_costexece_met_cost@type
end
declare@sqlvarchar(2000)
set@sql=select*,(eCostPrice+hCostPrice+mCostPrice)asTotalCostPricefrom(
select
isnull(A.Batch,B.Batch)asBatch,
isnull(A.MOID,B.MOID)asMOID,
isnull(A.Date,B.Date)asDate,
isnull(A.PMCPlanner,B.PMCPlanner)asPMCPlanner,
isnull(A.PMCPlannerName,B.PMCPlannerName)asPMCPlannerName,
isnull(A.eCostPrice,0)aseCostPrice,
isnull(A.hCostPrice,0)ashCostPrice,
isnull(B.mCostPrice,0)asmCostPricefrom
(
select
isnull(A.Batch,B.Batch)asBatch,
isnull(A.MOID,B.MOID)asMOID,
isnull(A.Date,B.Date)asDate,
isnull(A.PMCPlanner,B.PMCPlanner)asPMCPlanner,
isnull(A.PMCPlannerName,B.PMCPlannerName)asPMCPlannerName,
A.eCostPrice,B.hCostPricefrom#t_equ_costAfullouterjoin#t_hum_costBonA.Batch=B.Batch
)
Afullouterjoin#t_met_costBonA.Batch=B.Batch
)Awhere+@IsWhere;
execute(@sql)
droptable#t_met_cost
droptable#t_hum_cost
droptable#t_equ_cost
GO
使用C和C++编写,并使用了多种编译器进行测试,保证源代码的可移植性
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-6-3 18:16

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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