CREATE TABLE [dbo].[Sysuser]
(
[EMPNO] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[LASTNAME] [varchar] (26) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[FIRSTNAME] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MIDNAME] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[FUELPIN] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[COMID] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[HIREDATE] [datetime] NULL,
[EFFECTDATE] [datetime] NULL,
[EMAIL] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[STATUS] [int] NOT NULL,
[LNHAULPCT] [smallint] NULL,
[DRVCLASS] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DRVNO] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[VANNO] [varchar] (12) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SUNDAY] [smallint] NULL,
[MONDAY] [smallint] NULL,
[TUESDAY] [smallint] NULL,
[WEDNESDAY] [smallint] NULL,
[THURSDAY] [smallint] NULL,
[FRIDAY] [smallint] NULL,
[SATURDAY] [smallint] NULL,
[COMMENTS] [varchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[VoiceMailBoxNo] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SysUserID] [int] NOT NULL IDENTITY(1, 1),
[DTPriKey] [int] NULL,
[DivisionFID] [int] NULL,
[AdvanceCapTrip] [money] NULL,
[AdvanceCapOrder] [money] NULL,
[AllowOverlappingServiceHours] [bit] NOT NULL CONSTRAINT [DF_Sysuser_AllowOverlappingServiceHours] DEFAULT ((0)),
[CapacityBucketFID] [int] NULL,
[MssTimeZoneFID] [int] NULL,
[XmlSystemTimeclockFid] [int] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[Sysuser] ADD CONSTRAINT [PK_Sysuser] PRIMARY KEY CLUSTERED ([SysUserID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_SysUser_CapacityBucketFID] ON [dbo].[Sysuser] ([CapacityBucketFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_SysUser_EMAIL] ON [dbo].[Sysuser] ([EMAIL]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_SysUser_FirstLastNames] ON [dbo].[Sysuser] ([FIRSTNAME], [LASTNAME]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_SysUser_DaysOfWeek] ON [dbo].[Sysuser] ([STATUS], [SysUserID], [FIRSTNAME], [LASTNAME]) INCLUDE ([FRIDAY], [MONDAY], [SATURDAY], [SUNDAY], [THURSDAY], [TUESDAY], [WEDNESDAY]) ON [PRIMARY]
GO
CREATE STATISTICS [STATS_SysUser_2] ON [dbo].[Sysuser] ([SysUserID], [FIRSTNAME], [LASTNAME])
GO
CREATE STATISTICS [STATS_SysUser_1] ON [dbo].[Sysuser] ([SysUserID], [STATUS], [FIRSTNAME], [LASTNAME])
GO
ALTER TABLE [dbo].[Sysuser] ADD CONSTRAINT [FK_Sysuser_CapacityBucket] FOREIGN KEY ([CapacityBucketFID]) REFERENCES [dbo].[CapacityBucket] ([CapacityBucketID])
GO
ALTER TABLE [dbo].[Sysuser] ADD CONSTRAINT [FK_Sysuser_Division] FOREIGN KEY ([DivisionFID]) REFERENCES [dbo].[Division] ([DivisionID])
GO
ALTER TABLE [dbo].[Sysuser] ADD CONSTRAINT [FK_Sysuser_DriverTypes] FOREIGN KEY ([DTPriKey]) REFERENCES [dbo].[DriverTypes] ([DTPriKey])
GO
ALTER TABLE [dbo].[Sysuser] ADD CONSTRAINT [FK_Sysuser_MssTimeZone] FOREIGN KEY ([MssTimeZoneFID]) REFERENCES [dbo].[MssTimeZone] ([MssTimeZoneID])
GO
ALTER TABLE [dbo].[Sysuser] ADD CONSTRAINT [FK_Sysuser_STATUS] FOREIGN KEY ([STATUS]) REFERENCES [dbo].[Status] ([PriKey])
GO
ALTER TABLE [dbo].[Sysuser] ADD CONSTRAINT [FK_Sysuser_XmlSystemTimeclock] FOREIGN KEY ([XmlSystemTimeclockFid]) REFERENCES [dbo].[XmlSystemTimeclock] ([XmlSystemTimeclockId])
GO
GRANT SELECT ON [dbo].[Sysuser] TO [MssExec]
GRANT INSERT ON [dbo].[Sysuser] TO [MssExec]
GRANT DELETE ON [dbo].[Sysuser] TO [MssExec]
GRANT UPDATE ON [dbo].[Sysuser] TO [MssExec]
GO