![Tables](../../Images/Table.gif)
[dbo].[InternationalContainer]
CREATE TABLE [dbo].[InternationalContainer]
(
[InternationalContainerID] [int] NOT NULL IDENTITY(1, 1),
[OrdersFID] [int] NOT NULL,
[InternationalContainerLoadTypeFID] [int] NULL,
[ContainerNumber] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Pieces] [int] NULL,
[GrossWeight] [int] NULL,
[TareWeight] [int] NULL,
[NetWeight] [int] NULL,
[SealNumber] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CubicFeet] [int] NULL,
[RequiredDate] [datetime] NULL,
[PositionedDate] [datetime] NULL,
[LoadedDate] [datetime] NULL,
[EmptyDate] [datetime] NULL,
[ReturnedDate] [datetime] NULL,
[SealNumber2] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[InternationalContainerSizeTypeFID] [int] NULL,
[AutoInContainer] [bit] NOT NULL CONSTRAINT [DF_InternationalContainer_AutoInContainer] DEFAULT ((0))
) ON [PRIMARY]
GO
create trigger [dbo].[InternationalContainerTaskFieldChanged] on [dbo].[InternationalContainer]
after update
as
set nocount on
if( update( RequiredDate ) or update( PositionedDate ) or update( LoadedDate ) or update( EmptyDate ) or update( ReturnedDate ) )
begin
update ToDo set ToDo.DueDate = dbo.udfTaskDueDate( ToDo.duetype, ToDo.duedays, dbo.GetInternationalContainerDateByOrderAndType( ToDo.OrderID, inserted.InternationalContainerID, DependencyDate.FieldName ) )
from ToDo
inner join inserted on inserted.OrdersFID = ToDo.OrderID
inner join DependencyDate on ToDo.DependencyDateID = DependencyDate.DependencyDateID
where DependencyDate.TableName = 'InternationalContainer'
end
GO
ALTER TABLE [dbo].[InternationalContainer] ADD CONSTRAINT [PK_InternationalContainer] PRIMARY KEY NONCLUSTERED ([InternationalContainerID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_InternationalContainer_ContainerNumber] ON [dbo].[InternationalContainer] ([ContainerNumber]) INCLUDE ([OrdersFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_InternationalContainer_OrdersFID] ON [dbo].[InternationalContainer] ([OrdersFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalContainer] ADD CONSTRAINT [FK_InternationalContainer_InternationalContainerLoadType] FOREIGN KEY ([InternationalContainerLoadTypeFID]) REFERENCES [dbo].[InternationalContainerLoadType] ([InternationalContainerLoadTypeID])
GO
ALTER TABLE [dbo].[InternationalContainer] ADD CONSTRAINT [FK_InternationalContainer_InternationalContainerSizeType] FOREIGN KEY ([InternationalContainerSizeTypeFID]) REFERENCES [dbo].[InternationalContainerSizeType] ([InternationalContainerSizeTypeID])
GO
ALTER TABLE [dbo].[InternationalContainer] ADD CONSTRAINT [FK_InternationalContainer_Orders] FOREIGN KEY ([OrdersFID]) REFERENCES [dbo].[Orders] ([PriKey])
GO
GRANT SELECT ON [dbo].[InternationalContainer] TO [MssExec]
GRANT INSERT ON [dbo].[InternationalContainer] TO [MssExec]
GRANT DELETE ON [dbo].[InternationalContainer] TO [MssExec]
GRANT UPDATE ON [dbo].[InternationalContainer] TO [MssExec]
GO