Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
- --TOP CORE
- ;WITH top_core_counts_cte AS (
- SELECT collect_schemas_operations_equipments.scoe_whst_wheel_style_part_number, ISNULL(wheel_styles.wheel_style, 'ND') AS 'wheel_style', schemas_operations_equipments.string3, SUM(CAST(collect_schemas_operations_equipments.quantity AS BIGINT)) AS 'Quantity_collect'
- FROM collect_schemas_operations_equipments
- LEFT JOIN
- wheel_styles ON collect_schemas_operations_equipments.scoe_whst_wheel_style_part_number = wheel_styles.wheel_style_part_number
- INNER JOIN
- schemas_operations_equipments ON collect_schemas_operations_equipments.scoe_schema_number = schemas_operations_equipments.schema_number AND
- collect_schemas_operations_equipments.scoe_schema_year = schemas_operations_equipments.schema_year
- WHERE (collect_schemas_operations_equipments.scoe_operation_key = '015')
- AND (collect_schemas_operations_equipments.scoe_equi_equipment_key <> 'MRB01')
- AND (effective_date < '12/31/2018 23:59:59')
- AND (collect_schemas_operations_equipments.opre_result_id = 'PRO')
- AND (collect_schemas_operations_equipments.scoe_site_key = 'P33')
- --AND (scoe_whst_wheel_style_part_number IN (SELECT * FROM SPLIT(@CastWSPN)) OR @CastWSPN = '-1')
- AND (collect_schemas_operations_equipments.record_status = 'ACT')
- GROUP BY collect_schemas_operations_equipments.scoe_whst_wheel_style_part_number, wheel_styles.wheel_style, schemas_operations_equipments.string3
- )
- INSERT INTO shots_wheel_styles_mold_components
- SELECT scoe_whst_wheel_style_part_number AS 'wheel_style_part_number', 'T/C' AS 'mold_component_key', string3 AS 'mold_letter', 'ACT' AS 'status', Quantity_collect AS 'quantity', '12/31/2018 23:59:59' as 'period', dbo.ufn_GetSite() AS 'site_key','cramirez' AS 'created_by', GETDATE() AS 'created_on', 'cramirez' AS 'modified_by', GETDATE() AS 'modified_on'
- FROM top_core_counts_cte
- -- SIDE CORE
- ;WITH top_core_counts_cte AS (
- SELECT collect_schemas_operations_equipments.scoe_whst_wheel_style_part_number, ISNULL(wheel_styles.wheel_style, 'ND') AS 'wheel_style', schemas_operations_equipments.string2, SUM(CAST(collect_schemas_operations_equipments.quantity AS BIGINT)) AS 'Quantity_collect'
- FROM collect_schemas_operations_equipments
- LEFT JOIN
- wheel_styles ON collect_schemas_operations_equipments.scoe_whst_wheel_style_part_number = wheel_styles.wheel_style_part_number
- INNER JOIN
- schemas_operations_equipments ON collect_schemas_operations_equipments.scoe_schema_number = schemas_operations_equipments.schema_number AND
- collect_schemas_operations_equipments.scoe_schema_year = schemas_operations_equipments.schema_year
- WHERE (collect_schemas_operations_equipments.scoe_operation_key = '015')
- AND (collect_schemas_operations_equipments.scoe_equi_equipment_key <> 'MRB01')
- AND (effective_date < '12/31/2018 23:59:59')
- AND (collect_schemas_operations_equipments.opre_result_id = 'PRO')
- AND (collect_schemas_operations_equipments.scoe_site_key = 'P33')
- --AND (scoe_whst_wheel_style_part_number IN (SELECT * FROM SPLIT(@CastWSPN)) OR @CastWSPN = '-1')
- AND (collect_schemas_operations_equipments.record_status = 'ACT')
- GROUP BY collect_schemas_operations_equipments.scoe_whst_wheel_style_part_number, wheel_styles.wheel_style, schemas_operations_equipments.string2
- )
- INSERT INTO shots_wheel_styles_mold_components
- SELECT scoe_whst_wheel_style_part_number AS 'wheel_style_part_number', 'F/C' AS 'mold_component_key', string2 AS 'mold_letter', 'ACT' AS 'status', Quantity_collect AS 'quantity', '12/31/2018 23:59:59' as 'period', dbo.ufn_GetSite() AS 'site_key', 'cramirez' AS 'created_by', GETDATE() AS 'created_on', 'cramirez' AS 'modified_by', GETDATE() AS 'modified_on'
- FROM top_core_counts_cte
- -- FACE CORE
- ;WITH top_core_counts_cte AS (
- SELECT collect_schemas_operations_equipments.scoe_whst_wheel_style_part_number, ISNULL(wheel_styles.wheel_style, 'ND') AS 'wheel_style', schemas_operations_equipments.string1, SUM(CAST(collect_schemas_operations_equipments.quantity AS BIGINT)) AS 'Quantity_collect'
- FROM collect_schemas_operations_equipments
- LEFT JOIN
- wheel_styles ON collect_schemas_operations_equipments.scoe_whst_wheel_style_part_number = wheel_styles.wheel_style_part_number
- INNER JOIN
- schemas_operations_equipments ON collect_schemas_operations_equipments.scoe_schema_number = schemas_operations_equipments.schema_number AND
- collect_schemas_operations_equipments.scoe_schema_year = schemas_operations_equipments.schema_year
- WHERE (collect_schemas_operations_equipments.scoe_operation_key = '015')
- AND (collect_schemas_operations_equipments.scoe_equi_equipment_key <> 'MRB01')
- AND (effective_date < '12/31/2018 23:59:59')
- AND (collect_schemas_operations_equipments.opre_result_id = 'PRO')
- AND (collect_schemas_operations_equipments.scoe_site_key = 'P33')
- --AND (scoe_whst_wheel_style_part_number IN (SELECT * FROM SPLIT(@CastWSPN)) OR @CastWSPN = '-1')
- AND (collect_schemas_operations_equipments.record_status = 'ACT')
- GROUP BY collect_schemas_operations_equipments.scoe_whst_wheel_style_part_number, wheel_styles.wheel_style, schemas_operations_equipments.string1
- )
- INSERT INTO shots_wheel_styles_mold_components
- SELECT scoe_whst_wheel_style_part_number AS 'wheel_style_part_number', 'F/C' AS 'mold_component_key', string1 AS 'mold_letter', 'ACT' AS 'status', Quantity_collect AS 'quantity', '12/31/2018 23:59:59' as 'period', dbo.ufn_GetSite() AS 'site_key', 'cramirez' AS 'created_by', GETDATE() AS 'created_on', 'cramirez' AS 'modified_by', GETDATE() AS 'modified_on'
- FROM top_core_counts_cte
- SET TRANSACTION ISOLATION LEVEL READ COMMITTED
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement