USE [Northwind]
GO
/****** Object:  StoredProcedure [dbo].[InsertProduct]    Script Date: 04/22/2009 14:36:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[InsertProduct]
			@ProductName nvarchar(40)
           ,@SupplierID int
           ,@CategoryID int
           ,@QuantityPerUnit nvarchar(20)
           ,@UnitPrice money
           ,@UnitsInStock smallint
           ,@UnitsOnOrder smallint
           ,@ReorderLevel smallint
           ,@Discontinued bit
AS

INSERT INTO [Northwind].[dbo].[Products]
           (ProductName
           ,SupplierID
           ,CategoryID
           ,QuantityPerUnit
           ,UnitPrice
           ,UnitsInStock
           ,UnitsOnOrder
           ,ReorderLevel
           ,Discontinued
           )
     VALUES
           (
           @ProductName
           ,@SupplierID
           ,@CategoryID
           ,@QuantityPerUnit
           ,@UnitPrice
           ,@UnitsInStock
           ,@UnitsOnOrder
           ,@ReorderLevel
           ,@Discontinued
          ) 
          
          Select SCOPE_IDENTITY()
GO
/****** Object:  StoredProcedure [dbo].[UpdateProduct]    Script Date: 04/22/2009 14:36:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[UpdateProduct]
			@ProductName nvarchar(40)
           ,@SupplierID int
           ,@CategoryID int
           ,@QuantityPerUnit nvarchar(20)
           ,@UnitPrice money
           ,@UnitsInStock smallint
           ,@UnitsOnOrder smallint
           ,@ReorderLevel smallint
           ,@Discontinued bit
           ,@ProductID int
AS

Update [Northwind].[dbo].[Products]
Set
           ProductName=@ProductName
           ,SupplierID=@SupplierID
           ,CategoryID=@CategoryID
           ,QuantityPerUnit=@QuantityPerUnit
           ,UnitPrice=@UnitPrice
           ,UnitsInStock=@UnitsInStock
           ,UnitsOnOrder=@UnitsOnOrder
           ,ReorderLevel=@ReorderLevel
           ,Discontinued=@Discontinued
Where
			ProductID=@ProductID
GO
/****** Object:  StoredProcedure [dbo].[DeleteProduct]    Script Date: 04/22/2009 14:36:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[DeleteProduct]
(
	@ProductID int	
)
	
AS

	Delete From Products Where ProductID=@ProductID

RETURN
GO
