CREATE TABLE [dbo].[WorkTickets]
(
[WorkTicketID] [int] NOT NULL IDENTITY(1, 1),
[OrdersPriKey] [int] NOT NULL,
[LocServPriKey] [int] NOT NULL,
[WorkTicketNumber] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[WorkTickets] ADD CONSTRAINT [PK_WorkTickets] PRIMARY KEY CLUSTERED ([WorkTicketID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_WorkTickets_WorkTicketNumber] ON [dbo].[WorkTickets] ([WorkTicketNumber]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[WorkTickets] ADD CONSTRAINT [FK_WorkTickets_LOCSERV] FOREIGN KEY ([LocServPriKey]) REFERENCES [dbo].[LocServ] ([PriKey])
GO
ALTER TABLE [dbo].[WorkTickets] ADD CONSTRAINT [FK_WorkTickets_ORDERS] FOREIGN KEY ([OrdersPriKey]) REFERENCES [dbo].[Orders] ([PriKey])
GO
GRANT SELECT ON [dbo].[WorkTickets] TO [MssExec]
GRANT INSERT ON [dbo].[WorkTickets] TO [MssExec]
GRANT DELETE ON [dbo].[WorkTickets] TO [MssExec]
GRANT UPDATE ON [dbo].[WorkTickets] TO [MssExec]
GO