insert/process multi-records without cursor
2008-01-17 11:34
134 查看
if object_id('Pr_ToSolver_ds_in_item_group_loc_period') is not null
drop proc Pr_ToSolver_ds_in_item_group_loc_period
create proc Pr_ToSolver_ds_in_item_group_loc_period
as
insert into ds_in_item_group_loc_period
(
item_group_name
,loc_name
,bucket_from_name
,bucket_to_name
,cc
,cc_ratio
,cc_ratio_over
,cc_over
,request_fixed_under
,request_fixed_over
,request_fix
,zero_out_build
)
select
distinct ig.ItemGroupName
,l.LocationName
,ltrim(str(b1.YearCode))+case
when b1.WorkWeekCode<=9 then '0'+ltrim(str(b1.WorkWeekCode))
when b1.WorkWeekCode>9 then ltrim(str(b1.WorkWeekCode))
end
as bucket_from_name
,ltrim(str(b2.YearCode))+case
when b2.WorkWeekCode<=9 then '0'+ltrim(str(b2.WorkWeekCode))
when b2.WorkWeekCode>9 then ltrim(str(b2.WorkWeekCode))
end
as bucket_to_name
,ilp.Capacity
,ilp.CapacityRatio
,0
,0
,0
,0
,0
,0
from
ItemGroup_Location_Period ilp
join ItemGroup ig
on ilp.ItemGroupId=ig.ItemGroupId
join Location l
on ilp.LocationId=l.LocationId
left join Bucket b1
on ilp.BucketId_From =b1.BucketId
left join Bucket b2
on ilp.BucketId_To =b2.BucketId
drop proc Pr_ToSolver_ds_in_item_group_loc_period
create proc Pr_ToSolver_ds_in_item_group_loc_period
as
insert into ds_in_item_group_loc_period
(
item_group_name
,loc_name
,bucket_from_name
,bucket_to_name
,cc
,cc_ratio
,cc_ratio_over
,cc_over
,request_fixed_under
,request_fixed_over
,request_fix
,zero_out_build
)
select
distinct ig.ItemGroupName
,l.LocationName
,ltrim(str(b1.YearCode))+case
when b1.WorkWeekCode<=9 then '0'+ltrim(str(b1.WorkWeekCode))
when b1.WorkWeekCode>9 then ltrim(str(b1.WorkWeekCode))
end
as bucket_from_name
,ltrim(str(b2.YearCode))+case
when b2.WorkWeekCode<=9 then '0'+ltrim(str(b2.WorkWeekCode))
when b2.WorkWeekCode>9 then ltrim(str(b2.WorkWeekCode))
end
as bucket_to_name
,ilp.Capacity
,ilp.CapacityRatio
,0
,0
,0
,0
,0
,0
from
ItemGroup_Location_Period ilp
join ItemGroup ig
on ilp.ItemGroupId=ig.ItemGroupId
join Location l
on ilp.LocationId=l.LocationId
left join Bucket b1
on ilp.BucketId_From =b1.BucketId
left join Bucket b2
on ilp.BucketId_To =b2.BucketId
相关文章推荐
- sendBroadcastAsUser——Calling a method in the system process without a qualified user
- multi-process & cpu with multi-cores
- Multisample & ShadowMap & PostProcess冲突解决
- GhostWriting: Writing to another process without opening it nor actually writing to it
- 【Chromium】多进程架构(Multi-process Architecture)
- Process multi-row data with cursor or without cursor[利用游标或者非游标处理多行数据]
- How to delete duplicate records from tables without Primary key
- BizTalk Orchestration Publish Host In-Process Wcf Service without IIS 多种供客户端调用方式
- gdb提示“you can't do that without a process to debug"解决方法
- difference between Multi process and multi thread
- Multisample & ShadowMap & PostProcess冲突解决
- sendBroadcastAsUser——Calling a method in the system process without a qualified user 包含去电流程
- Error:Execution failed for task ':app:processXXXDebugManifest'. > Manifest merger failed with multi
- multi-core solr deploy process(not complete)
- javascript insert text on cursor postion
- python插入记录后取得主键id的方法(cursor.lastrowid和conn.insert_id())
- Flex Air bug: Process terminated without establishing connection to debugger. Command: "d:/Program Files/Adobe/Flex Builder 3/
- sendBroadcastAsUser——Calling a method in the system process without a qualified user
- process terminated without establishing connection to debugger.
- multi-core solr deploy process(not complete)