Tables [dbo].[SOOrders]
PropertyValue
CollationSQL_Latin1_General_CP1_CI_AS
Row Count (~)0
Created12:55:54 AM Thursday, March 21, 2019
Last Modified1:16:22 AM Thursday, March 21, 2019
KeyNameData TypeMax Length (Bytes)Allow NullsDefault
Cluster Primary Key PK_SOOrders: SOIDSOIDint4
False
SONumbervarchar(15)15
False
Foreign Keys FK_SOOrders_CustomerID_ARCustomers: [dbo].[ARCustomers].CustomerIDCustomerIDint4
False
Foreign Keys FK_SOOrders_BillToID_ARCustomers: [dbo].[ARCustomers].BillToIDBillToIDint4
False
Foreign Keys FK_SOOrders_LocationID_ARCustomers: [dbo].[ARCustomers].LocationIDLocationIDint4
True
Datedatetime8
False
Descriptionvarchar(255)255
False
PONumbervarchar(32)32
False
ReqDatedatetime8
True
Foreign Keys FK_SOOrders_TermID_ShTerms: [dbo].[ShTerms].TermIDTermIDint4
True
TermDiscountRatefloat8
False
TermDiscountDatedatetime8
True
DueDatedatetime8
False
Foreign Keys FK_SOOrders_ShipMethodID_ShShipMethods: [dbo].[ShShipMethods].ShipMethodIDShipMethodIDint4
True
Foreign Keys FK_SOOrders_JobID_ICJobs: [dbo].[ICJobs].JobIDJobIDint4
True
Foreign Keys FK_SOOrders_SalesRepID_ARSalesReps: [dbo].[ARSalesReps].SalesRepIDSalesRepIDint4
True
MailToAttnvarchar(64)64
False
MailToNamevarchar(128)128
False
MailToAddressvarchar(64)64
False
MailToCityvarchar(32)32
False
MailToStatevarchar(16)16
False
MailToZipvarchar(16)16
False
MailToCountryvarchar(16)16
False
ShipToNamevarchar(128)128
False
ShipToAttnvarchar(64)64
False
ShipToAddressvarchar(64)64
False
ShipToCityvarchar(32)32
False
ShipToStatevarchar(16)16
False
ShipToZipvarchar(16)16
False
ShipToCountryvarchar(16)16
False
Remarksvarchar(1024)1024
False
DiscountRatedecimal(18,6)9
False
Foreign Keys FK_SOOrders_DiscountGLID_GLAccounts: [dbo].[GLAccounts].DiscountGLIDDiscountGLIDint4
True
Discountmoney8
False
((0))
Foreign Keys FK_SOOrders_FreightGLID_GLAccounts: [dbo].[GLAccounts].FreightGLIDFreightGLIDint4
True
Freightmoney8
False
((0))
Foreign Keys FK_SOOrders_TaxCodeID_ShTaxCodes: [dbo].[ShTaxCodes].TaxCodeIDTaxCodeIDint4
True
Taxmoney8
False
((0))
Foreign Keys FK_SOOrders_GLID_GLAccounts: [dbo].[GLAccounts].GLIDGLIDint4
False
Totalmoney8
False
((0))
Foreign Keys FK_SOOrders_ApprovedByID_PREmployees: [dbo].[PREmployees].ApprovedByIDApprovedByIDint4
True
CreatorIDchar(8)8
False
UpdatorIDchar(8)8
False
CreateDatedatetime8
False
(getdate())
LastUpdatedatetime8
False
(getdate())
timestamptimestamp8
False
OnHoldbit1
False
Foreign Keys FK_SOOrders_OnHoldCodeID_ShOnHoldCodes: [dbo].[ShOnHoldCodes].OnHoldCodeIDOnHoldCodeIDint4
True
OnHoldReleaseDatedatetime8
True
OnHoldReleaserIDvarchar(8)8
True
ResponseCalcOverrideDatedatetime8
True
Foreign Keys FK_SOOrders_BranchID_GLBranches: [dbo].[GLBranches].BranchIDBranchIDint4
False
Foreign Keys FK_SOOrders_ARBranchID_GLBranches: [dbo].[GLBranches].ARBranchIDARBranchIDint4
False
Foreign Keys FK_SOOrders_ChargeMethodID_ARChargeMethods: [dbo].[ARChargeMethods].ChargeMethodIDChargeMethodIDint4
True
ChargeAccountInfovarchar(64)64
False
('')
Taxablebit1
False
((1))
Foreign Keys FK_SOOrders_FreightDeptID_GLDepts: [dbo].[GLDepts].FreightDeptIDFreightDeptIDint4
True
Foreign Keys FK_SOOrders_DiscountDeptID_GLDepts: [dbo].[GLDepts].DiscountDeptIDDiscountDeptIDint4
True
DBFileHeaderIDint4
False
((1))
AmountTotalmoney8
False
((0))
AmountPicketedmoney8
False
((0))
AmountShippedmoney8
False
((0))
AmountFulFilledmoney8
False
((0))
AmountBilledmoney8
False
((0))
QuantityTotaldecimal(18,2)9
False
((0))
QuantityShippeddecimal(18,2)9
False
((0))
QuantityFulfilleddecimal(18,2)9
False
((0))
QuantityBilleddecimal(18,2)9
False
((0))
BilledFreightmoney8
False
((0))
Foreign Keys FK_SOOrders_OrderTypeID_SOOrderTypes: [dbo].[SOOrderTypes].OrderTypeIDOrderTypeIDint4
False
((1))
Foreign Keys FK_SOOrders_WarehouseID_ICWarehouses: [dbo].[ICWarehouses].WarehouseIDWarehouseIDint4
True
Foreign Keys FK_SOOrders_DeptID_GLDepts: [dbo].[GLDepts].DeptIDDeptIDint4
True
AmountBackOrderedmoney8
False
((0))
QuantityBackOrdereddecimal(18,2)9
False
((0))
Foreign Keys FK_SOOrders_NoteID_SOOrderNotes: [dbo].[SOOrderNotes].NoteIDNoteIDint4
True
NoteFlagint4
False
((0))
BaseTypeIDint4
False
((1))
Foreign Keys FK_SOOrders_StatusID_SOStatuses: [dbo].[SOStatuses].StatusIDStatusIDint4
False
((1))
Foreign Keys FK_SOOrders_DetailStatusID_SODetailStatuses: [dbo].[SODetailStatuses].DetailStatusIDDetailStatusIDint4
False
((0))
Foreign Keys FK_SOOrders_ReturnDetailStatusID_SODetailStatuses: [dbo].[SODetailStatuses].ReturnDetailStatusIDReturnDetailStatusIDint4
False
((0))
Foreign Keys FK_SOOrders_ReturnCodeID_ICReturnCodes: [dbo].[ICReturnCodes].ReturnCodeIDReturnCodeIDint4
True
Foreign Keys FK_SOOrders_OrigInvoiceID_ARInvoices: [dbo].[ARInvoices].OrigInvoiceIDOrigInvoiceIDint4
True
Foreign Keys FK_SOOrders_ReturnMethodID_ShShipMethods: [dbo].[ShShipMethods].ReturnMethodIDReturnMethodIDint4
True
Foreign Keys FK_SOOrders_ReturnWarehouseID_ICWarehouses: [dbo].[ICWarehouses].ReturnWarehouseIDReturnWarehouseIDint4
True
Foreign Keys FK_SOOrders_ShTrackingConfigID_ShTrackingConfigs: [dbo].[ShTrackingConfigs].ShTrackingConfigIDShTrackingConfigIDint4
True
OutCostNotesvarchar(1024)1024
False
('')
Foreign Keys FK_SOOrders_OrderedByContactID_CMContacts: [dbo].[CMContacts].OrderedByContactIDOrderedByContactIDint4
True
Foreign Keys FK_SOOrders_QuoteID_SOQuotes: [dbo].[SOQuotes].QuoteIDQuoteIDint4
True
QuoteOriginationIDint4
True
QuoteOriginatorEmailvarchar(255)255
True
NoteCountint4
False
((0))
SendShippingNotificationsbit1
False
((0))
SendShippingNotificationToOrderByContactbit1
False
((0))
ShippingNotificationAdditionalEmailsvarchar(1024)1024
False
('')
Foreign Keys FK_SOOrders_TaxExemptCodeID_SHTaxExemptCodes: [dbo].[SHTaxExemptCodes].TaxExemptCodeIDTaxExemptCodeIDint4
True
FreightTaxFlagint4
False
Foreign Keys FK_SOOrders_FreightTaxFlagID_ShTaxFlags: [dbo].[ShTaxFlags].FreightTaxFlagIDFreightTaxFlagIDint4
False
KeyNameKey ColumnsUniqueFill Factor
Cluster Primary Key PK_SOOrders: SOIDPK_SOOrdersSOID
True
80
NameNo CheckColumns
FK_SOOrders_ApprovedByID_PREmployeesApprovedByID->[dbo].[PREmployees].[EmployeeID]
FK_SOOrders_ARBranchID_GLBranchesARBranchID->[dbo].[GLBranches].[BranchID]
FK_SOOrders_BillToID_ARCustomers
True
BillToID->[dbo].[ARCustomers].[CustomerID]
FK_SOOrders_BranchID_GLBranchesBranchID->[dbo].[GLBranches].[BranchID]
FK_SOOrders_ChargeMethodID_ARChargeMethodsChargeMethodID->[dbo].[ARChargeMethods].[ChargeMethodID]
FK_SOOrders_CustomerID_ARCustomers
True
CustomerID->[dbo].[ARCustomers].[CustomerID]
FK_SOOrders_DeptID_GLDeptsDeptID->[dbo].[GLDepts].[DeptID]
FK_SOOrders_DetailStatusID_SODetailStatusesDetailStatusID->[dbo].[SODetailStatuses].[DetailStatusID]
FK_SOOrders_DiscountDeptID_GLDeptsDiscountDeptID->[dbo].[GLDepts].[DeptID]
FK_SOOrders_DiscountGLID_GLAccountsDiscountGLID->[dbo].[GLAccounts].[AccountID]
FK_SOOrders_FreightDeptID_GLDeptsFreightDeptID->[dbo].[GLDepts].[DeptID]
FK_SOOrders_FreightGLID_GLAccountsFreightGLID->[dbo].[GLAccounts].[AccountID]
FK_SOOrders_FreightTaxFlagID_ShTaxFlagsFreightTaxFlagID->[dbo].[ShTaxFlags].[TaxFlagID]
FK_SOOrders_GLID_GLAccountsGLID->[dbo].[GLAccounts].[AccountID]
FK_SOOrders_JobID_ICJobsJobID->[dbo].[ICJobs].[JobID]
FK_SOOrders_LocationID_ARCustomers
True
LocationID->[dbo].[ARCustomers].[CustomerID]
FK_SOOrders_NoteID_SOOrderNotesNoteID->[dbo].[SOOrderNotes].[NoteID]
FK_SOOrders_OnHoldCodeID_ShOnHoldCodesOnHoldCodeID->[dbo].[ShOnHoldCodes].[OnHoldCodeID]
FK_SOOrders_OrderedByContactID_CMContactsOrderedByContactID->[dbo].[CMContacts].[ContactID]
FK_SOOrders_OrderTypeID_SOOrderTypesOrderTypeID->[dbo].[SOOrderTypes].[OrderTypeID]
FK_SOOrders_OrigInvoiceID_ARInvoicesOrigInvoiceID->[dbo].[ARInvoices].[InvoiceID]
FK_SOOrders_QuoteID_SOQuotesQuoteID->[dbo].[SOQuotes].[QuoteID]
FK_SOOrders_ReturnCodeID_ICReturnCodesReturnCodeID->[dbo].[ICReturnCodes].[ReturnCodeID]
FK_SOOrders_ReturnDetailStatusID_SODetailStatusesReturnDetailStatusID->[dbo].[SODetailStatuses].[DetailStatusID]
FK_SOOrders_ReturnMethodID_ShShipMethodsReturnMethodID->[dbo].[ShShipMethods].[ShipMethodID]
FK_SOOrders_ReturnWarehouseID_ICWarehousesReturnWarehouseID->[dbo].[ICWarehouses].[WarehouseID]
FK_SOOrders_SalesRepID_ARSalesRepsSalesRepID->[dbo].[ARSalesReps].[SalesRepID]
FK_SOOrders_ShipMethodID_ShShipMethodsShipMethodID->[dbo].[ShShipMethods].[ShipMethodID]
FK_SOOrders_ShTrackingConfigID_ShTrackingConfigsShTrackingConfigID->[dbo].[ShTrackingConfigs].[ShTrackingConfigID]
FK_SOOrders_StatusID_SOStatusesStatusID->[dbo].[SOStatuses].[StatusID]
FK_SOOrders_TaxCodeID_ShTaxCodesTaxCodeID->[dbo].[ShTaxCodes].[TaxCodeID]
FK_SOOrders_TaxExemptCodeID_SHTaxExemptCodesTaxExemptCodeID->[dbo].[SHTaxExemptCodes].[TaxExemptCodeID]
FK_SOOrders_TermID_ShTermsTermID->[dbo].[ShTerms].[TermID]
FK_SOOrders_WarehouseID_ICWarehousesWarehouseID->[dbo].[ICWarehouses].[WarehouseID]
CREATE TABLE [dbo].[SOOrders]
(
[SOID] [int] NOT NULL,
[SONumber] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CustomerID] [int] NOT NULL,
[BillToID] [int] NOT NULL,
[LocationID] [int] NULL,
[Date] [datetime] NOT NULL,
[Description] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[PONumber] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ReqDate] [datetime] NULL,
[TermID] [int] NULL,
[TermDiscountRate] [float] NOT NULL,
[TermDiscountDate] [datetime] NULL,
[DueDate] [datetime] NOT NULL,
[ShipMethodID] [int] NULL,
[JobID] [int] NULL,
[SalesRepID] [int] NULL,
[MailToAttn] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MailToName] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MailToAddress] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MailToCity] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MailToState] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MailToZip] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MailToCountry] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ShipToName] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ShipToAttn] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ShipToAddress] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ShipToCity] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ShipToState] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ShipToZip] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ShipToCountry] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Remarks] [varchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DiscountRate] [decimal] (18, 6) NOT NULL,
[DiscountGLID] [int] NULL,
[Discount] [money] NOT NULL CONSTRAINT [DF_SOOrders_Discount] DEFAULT ((0)),
[FreightGLID] [int] NULL,
[Freight] [money] NOT NULL CONSTRAINT [DF_SOOrders_Freight] DEFAULT ((0)),
[TaxCodeID] [int] NULL,
[Tax] [money] NOT NULL CONSTRAINT [DF_SOOrders_Tax] DEFAULT ((0)),
[GLID] [int] NOT NULL,
[Total] [money] NOT NULL CONSTRAINT [DF_SOOrders_Total] DEFAULT ((0)),
[ApprovedByID] [int] NULL,
[CreatorID] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[UpdatorID] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CreateDate] [datetime] NOT NULL CONSTRAINT [DF_SOOrders_CreateDate] DEFAULT (getdate()),
[LastUpdate] [datetime] NOT NULL CONSTRAINT [DF_SOOrders_LastUpdate] DEFAULT (getdate()),
[timestamp] [timestamp] NOT NULL,
[OnHold] [bit] NOT NULL,
[OnHoldCodeID] [int] NULL,
[OnHoldReleaseDate] [datetime] NULL,
[OnHoldReleaserID] [varchar] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ResponseCalcOverrideDate] [datetime] NULL,
[BranchID] [int] NOT NULL,
[ARBranchID] [int] NOT NULL,
[ChargeMethodID] [int] NULL,
[ChargeAccountInfo] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_SOOrders_ChargeAccountInfo] DEFAULT (''),
[Taxable] [bit] NOT NULL CONSTRAINT [DF_SOOrders_Taxable] DEFAULT ((1)),
[FreightDeptID] [int] NULL,
[DiscountDeptID] [int] NULL,
[DBFileHeaderID] [int] NOT NULL CONSTRAINT [DF_SOOrders_DBFileHeaderID] DEFAULT ((1)),
[AmountTotal] [money] NOT NULL CONSTRAINT [DF_SOOrders_AmountTotal] DEFAULT ((0)),
[AmountPicketed] [money] NOT NULL CONSTRAINT [DF_SOOrders_AmountPicketed] DEFAULT ((0)),
[AmountShipped] [money] NOT NULL CONSTRAINT [DF_SOOrders_AmountShipped] DEFAULT ((0)),
[AmountFulFilled] [money] NOT NULL CONSTRAINT [DF_SOOrders_AmountFulFilled] DEFAULT ((0)),
[AmountBilled] [money] NOT NULL CONSTRAINT [DF_SOOrders_AmountBilled] DEFAULT ((0)),
[QuantityTotal] [decimal] (18, 2) NOT NULL CONSTRAINT [DF_SOOrders_QuantityTotal] DEFAULT ((0)),
[QuantityShipped] [decimal] (18, 2) NOT NULL CONSTRAINT [DF_SOOrders_QuantityShipped] DEFAULT ((0)),
[QuantityFulfilled] [decimal] (18, 2) NOT NULL CONSTRAINT [DF_SOOrders_QuantityFulfilled] DEFAULT ((0)),
[QuantityBilled] [decimal] (18, 2) NOT NULL CONSTRAINT [DF_SOOrders_QuantityBilled] DEFAULT ((0)),
[BilledFreight] [money] NOT NULL CONSTRAINT [DF_SOOrders_BilledFreight] DEFAULT ((0)),
[OrderTypeID] [int] NOT NULL CONSTRAINT [DF_SOOrders_OrderTypeID] DEFAULT ((1)),
[WarehouseID] [int] NULL,
[DeptID] [int] NULL,
[AmountBackOrdered] [money] NOT NULL CONSTRAINT [DF_SOOrders_AmountBackOrdered] DEFAULT ((0)),
[QuantityBackOrdered] [decimal] (18, 2) NOT NULL CONSTRAINT [DF_SOOrders_QuantityBackOrdered] DEFAULT ((0)),
[NoteID] [int] NULL,
[NoteFlag] [int] NOT NULL CONSTRAINT [DF_SOOrders_NoteFlag] DEFAULT ((0)),
[BaseTypeID] [int] NOT NULL CONSTRAINT [DF_SOOrders_BaseTypeID] DEFAULT ((1)),
[StatusID] [int] NOT NULL CONSTRAINT [DF_SOOrders_StatusID] DEFAULT ((1)),
[DetailStatusID] [int] NOT NULL CONSTRAINT [DF_SOOrders_DetailStatusID] DEFAULT ((0)),
[ReturnDetailStatusID] [int] NOT NULL CONSTRAINT [DF_SOOrders_ReturnDetailStatusID] DEFAULT ((0)),
[ReturnCodeID] [int] NULL,
[OrigInvoiceID] [int] NULL,
[ReturnMethodID] [int] NULL,
[ReturnWarehouseID] [int] NULL,
[ShTrackingConfigID] [int] NULL,
[OutCostNotes] [varchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_SOOrders_OutCostNotes] DEFAULT (''),
[OrderedByContactID] [int] NULL,
[QuoteID] [int] NULL,
[QuoteOriginationID] [int] NULL,
[QuoteOriginatorEmail] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[NoteCount] [int] NOT NULL CONSTRAINT [DF_SOOrders_NoteCount] DEFAULT ((0)),
[SendShippingNotifications] [bit] NOT NULL CONSTRAINT [DF_SOOrders_SendShippingNotifications] DEFAULT ((0)),
[SendShippingNotificationToOrderByContact] [bit] NOT NULL CONSTRAINT [DF_SOOrders_SendShippingNotificationToOrderByContact] DEFAULT ((0)),
[ShippingNotificationAdditionalEmails] [varchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_SOOrders_ShippingNotificationAdditionalEmails] DEFAULT (''),
[TaxExemptCodeID] [int] NULL,
[FreightTaxFlag] [int] NOT NULL,
[FreightTaxFlagID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [PK_SOOrders] PRIMARY KEY CLUSTERED  ([SOID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_ApprovedByID_PREmployees] FOREIGN KEY ([ApprovedByID]) REFERENCES [dbo].[PREmployees] ([EmployeeID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_ARBranchID_GLBranches] FOREIGN KEY ([ARBranchID]) REFERENCES [dbo].[GLBranches] ([BranchID])
GO
ALTER TABLE [dbo].[SOOrders] WITH NOCHECK ADD CONSTRAINT [FK_SOOrders_BillToID_ARCustomers] FOREIGN KEY ([BillToID]) REFERENCES [dbo].[ARCustomers] ([CustomerID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_BranchID_GLBranches] FOREIGN KEY ([BranchID]) REFERENCES [dbo].[GLBranches] ([BranchID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_ChargeMethodID_ARChargeMethods] FOREIGN KEY ([ChargeMethodID]) REFERENCES [dbo].[ARChargeMethods] ([ChargeMethodID])
GO
ALTER TABLE [dbo].[SOOrders] WITH NOCHECK ADD CONSTRAINT [FK_SOOrders_CustomerID_ARCustomers] FOREIGN KEY ([CustomerID]) REFERENCES [dbo].[ARCustomers] ([CustomerID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_DeptID_GLDepts] FOREIGN KEY ([DeptID]) REFERENCES [dbo].[GLDepts] ([DeptID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_DetailStatusID_SODetailStatuses] FOREIGN KEY ([DetailStatusID]) REFERENCES [dbo].[SODetailStatuses] ([DetailStatusID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_DiscountDeptID_GLDepts] FOREIGN KEY ([DiscountDeptID]) REFERENCES [dbo].[GLDepts] ([DeptID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_DiscountGLID_GLAccounts] FOREIGN KEY ([DiscountGLID]) REFERENCES [dbo].[GLAccounts] ([AccountID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_FreightDeptID_GLDepts] FOREIGN KEY ([FreightDeptID]) REFERENCES [dbo].[GLDepts] ([DeptID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_FreightGLID_GLAccounts] FOREIGN KEY ([FreightGLID]) REFERENCES [dbo].[GLAccounts] ([AccountID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_FreightTaxFlagID_ShTaxFlags] FOREIGN KEY ([FreightTaxFlagID]) REFERENCES [dbo].[ShTaxFlags] ([TaxFlagID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_GLID_GLAccounts] FOREIGN KEY ([GLID]) REFERENCES [dbo].[GLAccounts] ([AccountID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_JobID_ICJobs] FOREIGN KEY ([JobID]) REFERENCES [dbo].[ICJobs] ([JobID])
GO
ALTER TABLE [dbo].[SOOrders] WITH NOCHECK ADD CONSTRAINT [FK_SOOrders_LocationID_ARCustomers] FOREIGN KEY ([LocationID]) REFERENCES [dbo].[ARCustomers] ([CustomerID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_NoteID_SOOrderNotes] FOREIGN KEY ([NoteID]) REFERENCES [dbo].[SOOrderNotes] ([NoteID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_OnHoldCodeID_ShOnHoldCodes] FOREIGN KEY ([OnHoldCodeID]) REFERENCES [dbo].[ShOnHoldCodes] ([OnHoldCodeID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_OrderedByContactID_CMContacts] FOREIGN KEY ([OrderedByContactID]) REFERENCES [dbo].[CMContacts] ([ContactID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_OrderTypeID_SOOrderTypes] FOREIGN KEY ([OrderTypeID]) REFERENCES [dbo].[SOOrderTypes] ([OrderTypeID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_OrigInvoiceID_ARInvoices] FOREIGN KEY ([OrigInvoiceID]) REFERENCES [dbo].[ARInvoices] ([InvoiceID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_QuoteID_SOQuotes] FOREIGN KEY ([QuoteID]) REFERENCES [dbo].[SOQuotes] ([QuoteID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_ReturnCodeID_ICReturnCodes] FOREIGN KEY ([ReturnCodeID]) REFERENCES [dbo].[ICReturnCodes] ([ReturnCodeID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_ReturnDetailStatusID_SODetailStatuses] FOREIGN KEY ([ReturnDetailStatusID]) REFERENCES [dbo].[SODetailStatuses] ([DetailStatusID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_ReturnMethodID_ShShipMethods] FOREIGN KEY ([ReturnMethodID]) REFERENCES [dbo].[ShShipMethods] ([ShipMethodID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_ReturnWarehouseID_ICWarehouses] FOREIGN KEY ([ReturnWarehouseID]) REFERENCES [dbo].[ICWarehouses] ([WarehouseID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_SalesRepID_ARSalesReps] FOREIGN KEY ([SalesRepID]) REFERENCES [dbo].[ARSalesReps] ([SalesRepID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_ShipMethodID_ShShipMethods] FOREIGN KEY ([ShipMethodID]) REFERENCES [dbo].[ShShipMethods] ([ShipMethodID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_ShTrackingConfigID_ShTrackingConfigs] FOREIGN KEY ([ShTrackingConfigID]) REFERENCES [dbo].[ShTrackingConfigs] ([ShTrackingConfigID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_StatusID_SOStatuses] FOREIGN KEY ([StatusID]) REFERENCES [dbo].[SOStatuses] ([StatusID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_TaxCodeID_ShTaxCodes] FOREIGN KEY ([TaxCodeID]) REFERENCES [dbo].[ShTaxCodes] ([TaxCodeID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_TaxExemptCodeID_SHTaxExemptCodes] FOREIGN KEY ([TaxExemptCodeID]) REFERENCES [dbo].[SHTaxExemptCodes] ([TaxExemptCodeID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_TermID_ShTerms] FOREIGN KEY ([TermID]) REFERENCES [dbo].[ShTerms] ([TermID])
GO
ALTER TABLE [dbo].[SOOrders] ADD CONSTRAINT [FK_SOOrders_WarehouseID_ICWarehouses] FOREIGN KEY ([WarehouseID]) REFERENCES [dbo].[ICWarehouses] ([WarehouseID])
GO