USE [Customers]
GO
/****** Object: Table [dbo].[DomesticAddresses] Script Date: 04/01/2010 11:33:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[DomesticAddresses](
[DomesticAddressID] [int] IDENTITY(0,1) NOT NULL,
[TestSiteID] [int] NULL,
[StAddress] [varchar](max) NOT NULL,
[City] [varchar](max) NOT NULL,
[State] [char](2) NOT NULL,
[PostalCode] [char](5) NOT NULL,
CONSTRAINT [PK_DomesticTestSiteTestingAddress] PRIMARY KEY CLUSTERED
(
[DomesticAddressID] 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].[InternationalAddresses] Script Date: 04/01/2010 11:34:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[InternationalAddresses](
[InternationalAddressID] [int] IDENTITY(0,1) NOT NULL,
[StAddress] [varchar](max) NOT NULL,
[City] [varchar](max) NOT NULL,
[Country] [char](2) NOT NULL,
[PostalCode] [char](7) NOT NULL,
CONSTRAINT [PK_InternationalTestSiteTestingAddress] PRIMARY KEY CLUSTERED
(
[InternationalAddressID] 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].[ContactInformation] Script Date: 04/01/2010 11:34:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ContactInformation](
[ContactInfoID] [int] IDENTITY(1,1) NOT NULL,
[Fname] [varchar](max) NOT NULL,
[LName] [varchar](max) NOT NULL,
[Phone] [varchar](20) NOT NULL,
[Extension] [varchar](6) NULL,
[Fax] [varchar](20) NULL,
[Email] [varchar](max) NULL,
[JobTitle] [varchar](max) NULL,
CONSTRAINT [PK_TestSiteContactInfoID] PRIMARY KEY CLUSTERED
(
[ContactInfoID] 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].[TestSites] Script Date: 04/01/2010 11:35:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Customer](
[CustomerID] [int] IDENTITY(1,1) NOT NULL,
[CustomerName] [varchar](max) NOT NULL,
[DomesticAddressID] [int] NOT NULL,
[InternationalAddressID] [int] NOT NULL,
[ContactInformationID] [int] NOT NULL,
CONSTRAINT [PK_CustomerID] 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]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[customer] WITH CHECK ADD CONSTRAINT [FK_Customer_ContactInformation] FOREIGN KEY([ContactInformationID])
REFERENCES [dbo].[ContactInformation] ([ContactInfoID])
GO
ALTER TABLE [dbo].Customer CHECK CONSTRAINT [FK_Customer_ContactInformation]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'foreign key to Contact Information table.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Customer', @level2type=N'CONSTRAINT',@level2name=N'FK_Customer_ContactInformation'
GO
ALTER TABLE [dbo].[Customer] ADD CONSTRAINT [DF_Customer_DomesticAddressID] DEFAULT ((0)) FOR [DomesticAddressID]
GO
ALTER TABLE [dbo].[Customer] ADD CONSTRAINT [DF_Customer_InternationalAddressID] DEFAULT ((0)) FOR [InternationalAddressID]
GO
ALTER TABLE [dbo].[Customer] ADD CONSTRAINT [DF_Customer_ContactInformationID] DEFAULT ((0)) FOR [ContactInformationID]
GO