USE [Database]

IF OBJECT_ID('[Procedures].[insert_product_inflow_record]', 'P') IS NOT NULL
  DROP PROCEDURE [Procedures].[insert_product_inflow_record];
GO
CREATE PROCEDURE [Procedures].[insert_product_inflow_record]
  @barcode_product_value_id AS INT,
  @barcode_product_attribute_id AS INT,
  @supplier_id AS INT,
  @count AS INT,
  @full_price AS INT,
  @datetime AS DATETIME,
  @inserted_product_inflow_record_id INT = NULL OUTPUT
AS
  BEGIN TRANSACTION;
  INSERT INTO [Tables].[product_inflow_records]([barcode_product_value_id], [supplier_id], [count], [full_price], [datetime])
  VALUES (@barcode_product_value_id, @supplier_id, @count, @full_price, @datetime);
  SET @inserted_product_inflow_record_id = SCOPE_IDENTITY();
  COMMIT TRANSACTION;
GO
