USE [Database]

IF OBJECT_ID('[Procedures].[insert_product_outflow_record]', 'P') IS NOT NULL
  DROP PROCEDURE [Procedures].[insert_product_outflow_record];
GO
CREATE PROCEDURE [Procedures].[insert_product_outflow_record]
  @barcode_product_outflow_record_id AS INT,
  @count AS INT,
  @datetime AS DATETIME,
  @inserted_product_outflow_records INT = NULL OUTPUT
AS
  BEGIN TRANSACTION;
    INSERT INTO [Tables].[product_outflow_records]([barcode_product_value_id], [count], [datetime])
    VALUES (@barcode_product_outflow_record_id, @count, @datetime);
    SET @inserted_product_outflow_records = SCOPE_IDENTITY();
  COMMIT TRANSACTION;
GO