--begin tran
IF NOT EXISTS (SELECT 1 FROM sysobjects WHERE name = 'AddressMail')
BEGIN
CREATE TABLE [dbo].[AddressMail]
(
	[PkAddressMail] [int] IDENTITY(1,1) NOT NULL,
	[FkAddress] [int] NOT NULL,
	[MailType] [smallint] NOT NULL,
	[Mail] varchar(100) NOT NULL,
 CONSTRAINT [PK_AddressMail] PRIMARY KEY CLUSTERED 
(
	[PkAddressMail] ASC
)) ON [PRIMARY]

	CREATE NONCLUSTERED INDEX [IX_FkAddressMailType] ON [dbo].[AddressMail] 
	(
		[MailType] ASC,
		[FkAddress] DESC
	)
  ALTER TABLE [AddressMail] ADD CONSTRAINT FK_AddressMail_ReservationAddress 
    FOREIGN KEY (FkAddress)
    REFERENCES ReservationAddress (AddressNumber)
END

--rollback tran