USE [P21]
GO

/****** Object:  StoredProcedure [dbo].[nutech_sp_historical_inv_loc]    Script Date: 10/1/2024 11:02:35 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


-- =============================================
-- Author:		Fred Rappuhn, NuTech Services, LLC
-- Create date: 08/04/2018
-- Description:	create historical records of inv_loc
-- =============================================
CREATE PROCEDURE [dbo].[nutech_sp_historical_inv_loc]

AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
    declare @dateCreated datetime;

    select @dateCreated = getdate();

    insert into nutech_historical_inv_loc ( inv_mast_uid, location_id, moving_average_cost, company_id, date_created, qty_on_hand, purchase_class )
     select inv_mast_uid, location_id, moving_average_cost, company_id, @dateCreated, qty_on_hand, purchase_class
     from  [p21sqlro09].[az_112529_live].[dbo].[inv_loc]
     where moving_average_cost > 0;


END
GO


