CREATE TABLE [dbo].[TripOrd]
(
[PriKey] [int] NOT NULL IDENTITY(1, 1),
[OrdPriKey] [int] NOT NULL,
[TripPriKey] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TripOrd] ADD CONSTRAINT [PK_TRIPORD] PRIMARY KEY CLUSTERED ([PriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TripOrd] ADD CONSTRAINT [IX_TripOrd_OrdPriKey] UNIQUE NONCLUSTERED ([OrdPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TripOrd] ADD CONSTRAINT [FK_TRIPORD_ORDERS] FOREIGN KEY ([OrdPriKey]) REFERENCES [dbo].[Orders] ([PriKey])
GO
ALTER TABLE [dbo].[TripOrd] ADD CONSTRAINT [FK_TRIPORD_Trips] FOREIGN KEY ([TripPriKey]) REFERENCES [dbo].[Trips] ([PriKey])
GO
GRANT SELECT ON [dbo].[TripOrd] TO [MssExec]
GRANT INSERT ON [dbo].[TripOrd] TO [MssExec]
GRANT DELETE ON [dbo].[TripOrd] TO [MssExec]
GRANT UPDATE ON [dbo].[TripOrd] TO [MssExec]
GO