SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF OBJECT_ID('dbo.usp_GetLowProductInventory') IS NOT NULL
   DROP PROCEDURE dbo.usp_GetLowProductInventory
GO
-- =============================================
-- Author:		Eric Miles
-- Create date: 7/25/2009
-- Description:	
-- =============================================
CREATE PROCEDURE usp_GetLowProductInventory 
	-- Add the parameters for the stored procedure here
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	SELECT		p.[PartNum] as 'ProductsPartNum', p.[Description] as 'ProductsDescription',
				p.[Price] as 'ProductsPrice', p.[CurrentQty] as 'ProductsCurrentQty',
				p.[MinQty] as 'ProductsMinQty', p.[OrderQty] as 'ProductsOrderQty',
				v.[Name] as 'VendorsName', v.[Phone] as 'VendorsPhone'
	FROM		Products p
					LEFT OUTER JOIN Vendors v ON v.[VendorNo] = p.[VendorNo]
	WHERE		p.[Active] = 1 AND
				p.[ProductNo] <> 1 AND
				p.[CurrentQty] < p.MinQty
END
GO
