[dbo].[AccountProfilePreset]
CREATE TABLE [dbo].[AccountProfilePreset]
(
[AccountProfilePresetID] [int] NOT NULL IDENTITY(1, 1),
[AccountProfileFID] [int] NOT NULL,
[Name] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[County] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[AddressLocationTypeFID] [int] NULL,
[Consign] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ConsignContact] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[BuildingFID] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountProfilePreset] ADD CONSTRAINT [PK_AccountProfilePreset] PRIMARY KEY CLUSTERED ([AccountProfilePresetID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountProfilePreset] ADD CONSTRAINT [IX_AccountProfilePreset_AccountProfileFID_Name] UNIQUE NONCLUSTERED ([AccountProfileFID], [Name]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AccountProfilePreset] ADD CONSTRAINT [FK_AccountProfilePreset_AccountProfile] FOREIGN KEY ([AccountProfileFID]) REFERENCES [dbo].[AccountProfiles] ([AccountProfileID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AccountProfilePreset] ADD CONSTRAINT [FK_AccountProfilePreset_AddressLocationType] FOREIGN KEY ([AddressLocationTypeFID]) REFERENCES [dbo].[AddressLocationType] ([AddressLocationTypeID])
GO
ALTER TABLE [dbo].[AccountProfilePreset] ADD CONSTRAINT [FK_AccountProfilePreset_BuildingFID] FOREIGN KEY ([BuildingFID]) REFERENCES [dbo].[Buildings] ([BuildingID]) ON DELETE SET NULL
GO
GRANT SELECT ON [dbo].[AccountProfilePreset] TO [MssExec]
GRANT INSERT ON [dbo].[AccountProfilePreset] TO [MssExec]
GRANT DELETE ON [dbo].[AccountProfilePreset] TO [MssExec]
GRANT UPDATE ON [dbo].[AccountProfilePreset] TO [MssExec]
GO