USE [master] GO /****** Object: Database [Powershop] Script Date: 06/23/2010 15:35:04 ******/ CREATE DATABASE [Powershop] GO /****** Object: Table [dbo].[PowerUpdate] Script Date: 06/23/2010 15:34:13 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[PowerUpdate]( [id] [int] IDENTITY(1,1) NOT NULL, [DateTime] [datetime] NOT NULL, [Enabled] [bit] NOT NULL, CONSTRAINT [PK_Activity] PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[PowerItem] Script Date: 06/23/2010 15:34:13 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[PowerItem]( [id] [int] IDENTITY(1,1) NOT NULL, [PowerUpdateID] [int] NOT NULL, [Name] [nvarchar](128) NOT NULL, [Price] [decimal](9, 4) NOT NULL, [Type] [nvarchar](128) NOT NULL, [Description] [ntext] NULL, CONSTRAINT [PK_PowerItem] PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO /****** Object: View [dbo].[vPowerData] Script Date: 06/23/2010 15:34:14 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create view [dbo].[vPowerData] as SELECT PowerItem_1.id, PowerItem_1.Name, PowerItem_1.Price, PowerUpdate_1.DateTime FROM PowerItem AS PowerItem_1 INNER JOIN PowerUpdate AS PowerUpdate_1 ON PowerItem_1.PowerUpdateID = PowerUpdate_1.id GO /****** Object: Default [DF_Activity_DateTime] Script Date: 06/23/2010 15:34:13 ******/ ALTER TABLE [dbo].[PowerUpdate] ADD CONSTRAINT [DF_Activity_DateTime] DEFAULT (getdate()) FOR [DateTime] GO /****** Object: Default [DF_PowerUpdate_Enabled] Script Date: 06/23/2010 15:34:13 ******/ ALTER TABLE [dbo].[PowerUpdate] ADD CONSTRAINT [DF_PowerUpdate_Enabled] DEFAULT ((1)) FOR [Enabled] GO