CREATE TABLE [dbo].[ServType]
(
[ServiceID] [int] NOT NULL IDENTITY(1, 1),
[Service] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LaborType] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[UnitsPerHour] [int] NULL,
[ICPriKey] [int] NULL,
[BranchPriKey] [int] NOT NULL,
[ServTypeGPriKey] [int] NULL,
[StorageFlagIn] [smallint] NULL CONSTRAINT [DF_ServType_StorageFlagIn] DEFAULT (0),
[StorageFlagOut] [smallint] NULL CONSTRAINT [DF_ServType_StorageFlagOut] DEFAULT (0),
[ManualEntryHoursFlag] [smallint] NULL CONSTRAINT [DF_ServType_ManualEntryHoursFlag] DEFAULT (0),
[ContainerizationEligibleFlag] [bit] NOT NULL CONSTRAINT [DF_ServType_ContainerizationEligibleFlag] DEFAULT ((0)),
[Inactive] [bit] NOT NULL CONSTRAINT [DF_ServType_Inactive] DEFAULT ((0)),
[ServTypeClassFID] [int] NULL,
[AvailableToOrderInformation] [bit] NOT NULL CONSTRAINT [DF_ServType_AvailableToOrderInformation] DEFAULT ((0)),
[AvailableToInternational] [bit] NOT NULL CONSTRAINT [DF_ServType_AvailableToInternational] DEFAULT ((0)),
[AvailableToSpecialServices] [bit] NOT NULL CONSTRAINT [DF_ServType_AvailableToSpecialServices] DEFAULT ((0)),
[AvailableToOfficeIndustrial] [bit] NOT NULL CONSTRAINT [DF_ServType_AvailableToOfficeIndustrial] DEFAULT ((0)),
[UnitTypeFID] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ServType] ADD CONSTRAINT [PK_ServType] PRIMARY KEY CLUSTERED ([ServiceID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_ServType_BranchPriKey_Service] ON [dbo].[ServType] ([BranchPriKey], [Service]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ServType] ADD CONSTRAINT [FK_ServType_BRANCH] FOREIGN KEY ([BranchPriKey]) REFERENCES [dbo].[Branch] ([BranchPriKey])
GO
ALTER TABLE [dbo].[ServType] ADD CONSTRAINT [FK_ServType_ItemCode] FOREIGN KEY ([ICPriKey]) REFERENCES [dbo].[ItemCode] ([ICPriKey])
GO
ALTER TABLE [dbo].[ServType] ADD CONSTRAINT [FK_ServType_ServTypeClass] FOREIGN KEY ([ServTypeClassFID]) REFERENCES [dbo].[ServTypeClass] ([ServTypeClassID])
GO
ALTER TABLE [dbo].[ServType] ADD CONSTRAINT [FK_ServType_ServTypeGroup] FOREIGN KEY ([ServTypeGPriKey]) REFERENCES [dbo].[ServTypeGroup] ([ServiceTypeGPriKey])
GO
ALTER TABLE [dbo].[ServType] ADD CONSTRAINT [FK_ServType_UnitType] FOREIGN KEY ([UnitTypeFID]) REFERENCES [dbo].[UnitType] ([UnitTypeID])
GO
GRANT SELECT ON [dbo].[ServType] TO [MssExec]
GRANT INSERT ON [dbo].[ServType] TO [MssExec]
GRANT DELETE ON [dbo].[ServType] TO [MssExec]
GRANT UPDATE ON [dbo].[ServType] TO [MssExec]
GO