Tables [dbo].[Segment]
Properties
PropertyValue
HeapYes
Row Count (~)2
Created5:00:23 PM Monday, April 21, 2008
Last Modified11:13:41 AM Monday, August 19, 2013
Columns
NameData TypeMax Length (Bytes)Allow NullsIdentity
Primary Key PK_Segment: SegmentIDSegmentIDint4
No
1 - 1
Foreign Keys FK_Segment_OrderFID: [dbo].[Orders].OrderFIDIndexes IX_Segment_OrderFID: OrderFIDOrderFIDint4
No
SegmentNumberint4
No
Foreign Keys FK_Segment_OriginOrderAddressFID: [dbo].[OrderAddress].OriginOrderAddressFIDOriginOrderAddressFIDint4
Yes
Foreign Keys FK_Segment_OriginXtraStopAddressFID: [dbo].[XtraStopAddress].OriginXtraStopAddressFIDOriginXtraStopAddressFIDint4
Yes
Foreign Keys FK_Segment_DestinationOrderAddressFID: [dbo].[OrderAddress].DestinationOrderAddressFIDDestinationOrderAddressFIDint4
Yes
Foreign Keys FK_Segment_DestinationXtraStopAddressFID: [dbo].[XtraStopAddress].DestinationXtraStopAddressFIDDestinationXtraStopAddressFIDint4
Yes
EstimatedWeightint4
Yes
BilledWeightint4
Yes
EstimatedCubicFeetfloat8
Yes
BilledCubicFeetfloat8
Yes
EstimatedMilesint4
Yes
BilledMilesint4
Yes
StartPackDatedatetime8
Yes
EndPackDatedatetime8
Yes
StartLoadDatedatetime8
Yes
EndLoadDatedatetime8
Yes
StartLoadTimedatetime8
Yes
EndLoadTimedatetime8
Yes
StartDeliveryDatedatetime8
Yes
EndDeliveryDatedatetime8
Yes
StartDeliveryTimedatetime8
Yes
EndDeliveryTimedatetime8
Yes
Indexes Indexes
NameColumnsUniqueFill Factor
Primary Key PK_Segment: SegmentIDPK_SegmentSegmentID
Yes
80
IX_Segment_OrderFIDOrderFID80
Check Constraints Check Constraints
NameConstraint
CK_Segment_Addresses(([OriginOrderAddressFID] IS NOT NULL AND [OriginXtraStopAddressFID] IS NULL OR [OriginOrderAddressFID] IS NULL AND [OriginXtraStopAddressFID] IS NOT NULL) AND ([DestinationOrderAddressFID] IS NOT NULL AND [DestinationXtraStopAddressFID] IS NULL OR [DestinationOrderAddressFID] IS NULL AND [DestinationXtraStopAddressFID] IS NOT NULL))
Foreign Keys Foreign Keys
NameColumns
FK_Segment_DestinationOrderAddressFIDDestinationOrderAddressFID->[dbo].[OrderAddress].[OrderAddressID]
FK_Segment_DestinationXtraStopAddressFIDDestinationXtraStopAddressFID->[dbo].[XtraStopAddress].[XtraStopAddressID]
FK_Segment_OrderFIDOrderFID->[dbo].[Orders].[PriKey]
FK_Segment_OriginOrderAddressFIDOriginOrderAddressFID->[dbo].[OrderAddress].[OrderAddressID]
FK_Segment_OriginXtraStopAddressFIDOriginXtraStopAddressFID->[dbo].[XtraStopAddress].[XtraStopAddressID]
Permissions
TypeActionOwning Principal
GrantDeleteMssExec
GrantInsertMssExec
GrantSelectMssExec
GrantUpdateMssExec
SQL Script
CREATE TABLE [dbo].[Segment]
(
[SegmentID] [int] NOT NULL IDENTITY(1, 1),
[OrderFID] [int] NOT NULL,
[SegmentNumber] [int] NOT NULL,
[OriginOrderAddressFID] [int] NULL,
[OriginXtraStopAddressFID] [int] NULL,
[DestinationOrderAddressFID] [int] NULL,
[DestinationXtraStopAddressFID] [int] NULL,
[EstimatedWeight] [int] NULL,
[BilledWeight] [int] NULL,
[EstimatedCubicFeet] [float] NULL,
[BilledCubicFeet] [float] NULL,
[EstimatedMiles] [int] NULL,
[BilledMiles] [int] NULL,
[StartPackDate] [datetime] NULL,
[EndPackDate] [datetime] NULL,
[StartLoadDate] [datetime] NULL,
[EndLoadDate] [datetime] NULL,
[StartLoadTime] [datetime] NULL,
[EndLoadTime] [datetime] NULL,
[StartDeliveryDate] [datetime] NULL,
[EndDeliveryDate] [datetime] NULL,
[StartDeliveryTime] [datetime] NULL,
[EndDeliveryTime] [datetime] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Segment] ADD CONSTRAINT [CK_Segment_Addresses] CHECK ((([OriginOrderAddressFID] IS NOT NULL AND [OriginXtraStopAddressFID] IS NULL OR [OriginOrderAddressFID] IS NULL AND [OriginXtraStopAddressFID] IS NOT NULL) AND ([DestinationOrderAddressFID] IS NOT NULL AND [DestinationXtraStopAddressFID] IS NULL OR [DestinationOrderAddressFID] IS NULL AND [DestinationXtraStopAddressFID] IS NOT NULL)))
GO
ALTER TABLE [dbo].[Segment] ADD CONSTRAINT [PK_Segment] PRIMARY KEY NONCLUSTERED  ([SegmentID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Segment_OrderFID] ON [dbo].[Segment] ([OrderFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Segment] ADD CONSTRAINT [FK_Segment_DestinationOrderAddressFID] FOREIGN KEY ([DestinationOrderAddressFID]) REFERENCES [dbo].[OrderAddress] ([OrderAddressID])
GO
ALTER TABLE [dbo].[Segment] ADD CONSTRAINT [FK_Segment_DestinationXtraStopAddressFID] FOREIGN KEY ([DestinationXtraStopAddressFID]) REFERENCES [dbo].[XtraStopAddress] ([XtraStopAddressID])
GO
ALTER TABLE [dbo].[Segment] ADD CONSTRAINT [FK_Segment_OrderFID] FOREIGN KEY ([OrderFID]) REFERENCES [dbo].[Orders] ([PriKey])
GO
ALTER TABLE [dbo].[Segment] ADD CONSTRAINT [FK_Segment_OriginOrderAddressFID] FOREIGN KEY ([OriginOrderAddressFID]) REFERENCES [dbo].[OrderAddress] ([OrderAddressID])
GO
ALTER TABLE [dbo].[Segment] ADD CONSTRAINT [FK_Segment_OriginXtraStopAddressFID] FOREIGN KEY ([OriginXtraStopAddressFID]) REFERENCES [dbo].[XtraStopAddress] ([XtraStopAddressID])
GO
GRANT SELECT ON  [dbo].[Segment] TO [MssExec]
GRANT INSERT ON  [dbo].[Segment] TO [MssExec]
GRANT DELETE ON  [dbo].[Segment] TO [MssExec]
GRANT UPDATE ON  [dbo].[Segment] TO [MssExec]
GO
Uses