SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE procedure [dbo].[p_policies_situations_delete_input_data]
    @headers_table type_table_id readonly

as

    set nocount on;

    delete vooi
    from vw__obj_objects_insert vooi
	   inner join input_data_dump_history iddhh on vooi.obj_object_id = iddhh.iddhh_object_id
	   inner join @headers_table ht on ht.id = iddhh.iddhh_header_id
	   
    update iddh
	   set iddh_deleted = 1
    from input_data_dump_header iddh
	   inner join @headers_table ht on ht.id = iddh.iddh_header_id 


GO
