/****** Object:  ForeignKey [FK_tProduct_tProductCategory]    Script Date: 03/02/2008 20:00:15 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_tProduct_tProductCategory]') AND parent_object_id = OBJECT_ID(N'[dbo].[Products]'))
ALTER TABLE [dbo].[Products] DROP CONSTRAINT [FK_tProduct_tProductCategory]
GO
/****** Object:  Default [DF_tProductCategory_IsActive]    Script Date: 03/02/2008 20:00:15 ******/
IF  EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_tProductCategory_IsActive]') AND parent_object_id = OBJECT_ID(N'[dbo].[ProductCategories]'))
Begin
ALTER TABLE [dbo].[ProductCategories] DROP CONSTRAINT [DF_tProductCategory_IsActive]

End
GO
/****** Object:  Table [dbo].[Products]    Script Date: 03/02/2008 20:00:15 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Products]') AND type in (N'U'))
DROP TABLE [dbo].[Products]
GO
/****** Object:  Table [dbo].[ProductCategories]    Script Date: 03/02/2008 20:00:15 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ProductCategories]') AND type in (N'U'))
DROP TABLE [dbo].[ProductCategories]
GO
/****** Object:  Table [dbo].[ProductCategories]    Script Date: 03/02/2008 20:00:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ProductCategories]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ProductCategories](
	[CategoryID] [int] IDENTITY(1,1) NOT NULL,
	[CategoryName] [varchar](50) COLLATE Latin1_General_CI_AS NOT NULL,
	[IsActive] [bit] NOT NULL,
 CONSTRAINT [PK_tProductCategory] PRIMARY KEY CLUSTERED 
(
	[CategoryID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
)
END
GO
SET IDENTITY_INSERT [dbo].[ProductCategories] ON
INSERT [dbo].[ProductCategories] ([CategoryID], [CategoryName], [IsActive]) VALUES (1, N'EatNaturalBars', 1)
INSERT [dbo].[ProductCategories] ([CategoryID], [CategoryName], [IsActive]) VALUES (2, N'ForKids', 1)
INSERT [dbo].[ProductCategories] ([CategoryID], [CategoryName], [IsActive]) VALUES (3, N'ForNibbling', 1)
INSERT [dbo].[ProductCategories] ([CategoryID], [CategoryName], [IsActive]) VALUES (4, N'Breakfast', 1)
SET IDENTITY_INSERT [dbo].[ProductCategories] OFF
/****** Object:  Table [dbo].[Products]    Script Date: 03/02/2008 20:00:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Products]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Products](
	[ProductID] [int] IDENTITY(1,1) NOT NULL,
	[CategoryID] [int] NOT NULL,
	[ProductName] [varchar](255) COLLATE Latin1_General_CI_AS NOT NULL,
	[ImageURL] [varchar](75) COLLATE Latin1_General_CI_AS NOT NULL,
	[Ingredients] [text] COLLATE Latin1_General_CI_AS NULL,
	[NutritionInfoImageURL] [varchar](max) COLLATE Latin1_General_CI_AS NULL,
	[OrderID] [int] NULL,
 CONSTRAINT [PK_tProduct] PRIMARY KEY CLUSTERED 
(
	[ProductID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
)
END
GO
SET IDENTITY_INSERT [dbo].[Products] ON
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (1, 1, N'almonds apricots and a yoghurt coating', N'AAY.gif', N'None', N'AAY-Nutrition.gif', 10)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (2, 1, N'brazils sultanas almonds and hazelnuts', N'BSAH.gif', NULL, N'BSAH-Nutrition.gif', 20)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (3, 1, N'macadamias brazils and apricots ', N'MBA.gif', NULL, N'MBA-Nutrition.gif', 30)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (4, 1, N'blueberries pistachios and a yoghurt coating ', N'BP.gif', NULL, N'BP-Nutrition.gif', 40)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (5, 1, N'dates walnuts and pumpkin seeds ', N'DWP.gif', NULL, N'DWP-Nutrition.gif', 50)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (6, 1, N'cranberries macadamias and dark chocolate ', N'CMDC.gif', NULL, N'CMDC-Nutrition.gif', 60)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (7, 1, N'peanuts almonds and hazelnuts', N'PAH.gif', NULL, N'PAH-Nutrition.gif', 70)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (8, 1, N'peanuts cranberries pistachios and milk chocolate ', N'PCPMC.gif', NULL, N'PCPMC-Nutrition.gif', 80)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (9, 1, N'100% organic brazils hazelnuts and sultanas ', N'BHS.gif', NULL, N'BHS-Nutrition.gif', 100)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (10, 1, N'blackcurrants walnuts mango and dark chocolate ', N'BWMDC.gif', NULL, N'BWMDC-Nutrition.gif', 110)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (11, 1, N'pears hazelnuts and a hint of ginger with spanish blossom honey', N'PAGSBH.gif', NULL, N'PAGSBH-Nutrition.gif', 120)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (12, 1, N'cranberries hazelnuts orange and milk chocolate', N'CHOMC.gif', NULL, N'CHOMC-Nutrition.gif', 130)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (13, 2, N'blackcurrants apples and apricotss', N'BAA.jpg', NULL, N'BAA-Lunchies-Nutrition.gif', 20)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (14, 2, N'strawberries mango and a yoghurt coating', N'SMY.jpg', NULL, N'SMY-Lunchies-Nutrition.gif', 10)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (15, 3, N'almonds cranberries and cashews', N'ACC.jpg', NULL, N'ACC-Nutrition.gif', 10)
INSERT [dbo].[Products] ([ProductID], [CategoryID], [ProductName], [ImageURL], [Ingredients], [NutritionInfoImageURL], [OrderID]) VALUES (16, 3, N'apricot pumpkin seeds and chocolate', N'APSC.jpg', NULL, N'APSC-Nutrition.gif', 20)
SET IDENTITY_INSERT [dbo].[Products] OFF
/****** Object:  Default [DF_tProductCategory_IsActive]    Script Date: 03/02/2008 20:00:15 ******/
IF Not EXISTS (SELECT * FROM sys.default_constraints WHERE object_id = OBJECT_ID(N'[dbo].[DF_tProductCategory_IsActive]') AND parent_object_id = OBJECT_ID(N'[dbo].[ProductCategories]'))
Begin
ALTER TABLE [dbo].[ProductCategories] ADD  CONSTRAINT [DF_tProductCategory_IsActive]  DEFAULT ((1)) FOR [IsActive]

End
GO
/****** Object:  ForeignKey [FK_tProduct_tProductCategory]    Script Date: 03/02/2008 20:00:15 ******/
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_tProduct_tProductCategory]') AND parent_object_id = OBJECT_ID(N'[dbo].[Products]'))
ALTER TABLE [dbo].[Products]  WITH CHECK ADD  CONSTRAINT [FK_tProduct_tProductCategory] FOREIGN KEY([CategoryID])
REFERENCES [dbo].[ProductCategories] ([CategoryID])
GO
ALTER TABLE [dbo].[Products] CHECK CONSTRAINT [FK_tProduct_tProductCategory]
GO
