USE [master]
GO
/****** Object: Database [mydatabase] Script Date: 01/08/2018 10:41:23 ******/
CREATE DATABASE [mydatabase] ON PRIMARY
( NAME = N'mydatabase_Data', FILENAME = N'D:\database\mydatabase_Data.MDF' , SIZE = 1984KB , MAXSIZE = UNLIMITED, FILEGROWTH = 10%)
LOG ON
( NAME = N'mydatabase_Log', FILENAME = N'D:\database\mydatabase_Log.LDF' , SIZE = 3136KB , MAXSIZE = UNLIMITED, FILEGROWTH = 10%)
GO
ALTER DATABASE [mydatabase] SET COMPATIBILITY_LEVEL = 80
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [mydatabase].[dbo].[sp_fulltext_database] @action = 'disable'
end
GO
ALTER DATABASE [mydatabase] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [mydatabase] SET ANSI_NULLS OFF
GO
ALTER DATABASE [mydatabase] SET ANSI_PADDING OFF
GO
ALTER DATABASE [mydatabase] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [mydatabase] SET ARITHABORT OFF
GO
ALTER DATABASE [mydatabase] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [mydatabase] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [mydatabase] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [mydatabase] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [mydatabase] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [mydatabase] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [mydatabase] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [mydatabase] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [mydatabase] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [mydatabase] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [mydatabase] SET ENABLE_BROKER
GO
ALTER DATABASE [mydatabase] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [mydatabase] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [mydatabase] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [mydatabase] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [mydatabase] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [mydatabase] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [mydatabase] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [mydatabase] SET READ_WRITE
GO
ALTER DATABASE [mydatabase] SET RECOVERY FULL
GO
ALTER DATABASE [mydatabase] SET MULTI_USER
GO
ALTER DATABASE [mydatabase] SET PAGE_VERIFY NONE
GO
ALTER DATABASE [mydatabase] SET DB_CHAINING OFF
GO
USE [mydatabase]
GO
/****** Object: Table [dbo].[customer] Script Date: 01/08/2018 10:41:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[customer](
[CustomerID] [varchar](4) NOT NULL,
[Name] [varchar](50) NULL,
[Email] [varchar](50) NULL,
[CountryCode] [varchar](2) NULL,
[Budget] [float] NULL,
[Used] [float] NULL,
CONSTRAINT [PK_customer] PRIMARY KEY CLUSTERED
(
[CustomerID] 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
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[country] Script Date: 01/08/2018 10:41:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[country](
[CountryCode] [varchar](2) NOT NULL,
[CountryName] [varchar](50) NULL,
CONSTRAINT [PK_country] PRIMARY KEY CLUSTERED
(
[CountryCode] 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
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[audit] Script Date: 01/08/2018 10:41:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[audit](
[AuditID] [varchar](4) NOT NULL,
[CustomerID] [varchar](4) NULL,
[Date] [datetime] NULL,
[Used] [float] NULL,
CONSTRAINT [PK_audit] PRIMARY KEY CLUSTERED
(
[AuditID] 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
SET ANSI_PADDING OFF
GO
/****** Object: ForeignKey [FK_customer_audit] Script Date: 01/08/2018 10:41:25 ******/
ALTER TABLE [dbo].[audit] WITH NOCHECK ADD CONSTRAINT [FK_customer_audit] FOREIGN KEY([CustomerID])
REFERENCES [dbo].[customer] ([CustomerID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[audit] CHECK CONSTRAINT [FK_customer_audit]
GO