Tables [dbo].[InternationalCustomsInspectionDate]
Properties
PropertyValue
Row Count (~)0
Created9:06:37 AM Friday, December 7, 2018
Last Modified9:24:35 AM Friday, December 7, 2018
Columns
NameData TypeMax Length (Bytes)Allow NullsIdentity
Primary Key PK_InternationalCustomsInspectionDate: InternationalCustomsInspectionDateIDInternationalCustomsInspectionDateIDint4
No
1 - 1
Cluster Key IX_InternationalCustomsInspectionDate_InternationalCustomsInspectionInformationFID: InternationalCustomsInspectionInformationFIDForeign Keys FK_InternationalCustomsInspectionDate_InternationalCustomsInspectionInformation: [dbo].[InternationalCustomsInspectionInformation].InternationalCustomsInspectionInformationFIDInternationalCustomsInspectionInformationFIDint4
No
InspectionStartEstimatedDatedatetime8
Yes
InspectionStartActualDatedatetime8
Yes
InspectionEndEstimatedDatedatetime8
Yes
InspectionEndActualDatedatetime8
Yes
Indexes Indexes
NameColumnsUnique
Primary Key PK_InternationalCustomsInspectionDate: InternationalCustomsInspectionDateIDPK_InternationalCustomsInspectionDateInternationalCustomsInspectionDateID
Yes
Cluster Key IX_InternationalCustomsInspectionDate_InternationalCustomsInspectionInformationFID: InternationalCustomsInspectionInformationFIDIX_InternationalCustomsInspectionDate_InternationalCustomsInspectionInformationFIDInternationalCustomsInspectionInformationFID
Yes
Triggers Triggers
NameANSI Nulls OnQuoted Identifier OnOn
InternationalCustomsInspectionDateTaskFieldChanged
Yes
Yes
After Insert Update
Foreign Keys Foreign Keys
NameColumns
FK_InternationalCustomsInspectionDate_InternationalCustomsInspectionInformationInternationalCustomsInspectionInformationFID->[dbo].[InternationalCustomsInspectionInformation].[InternationalCustomsInspectionInformationID]
Permissions
TypeActionOwning Principal
GrantDeleteMssExec
GrantInsertMssExec
GrantSelectMssExec
GrantUpdateMssExec
SQL Script
CREATE TABLE [dbo].[InternationalCustomsInspectionDate]
(
[InternationalCustomsInspectionDateID] [int] NOT NULL IDENTITY(1, 1),
[InternationalCustomsInspectionInformationFID] [int] NOT NULL,
[InspectionStartEstimatedDate] [datetime] NULL,
[InspectionStartActualDate] [datetime] NULL,
[InspectionEndEstimatedDate] [datetime] NULL,
[InspectionEndActualDate] [datetime] NULL
) ON [PRIMARY]
GO

CREATE trigger [dbo].[InternationalCustomsInspectionDateTaskFieldChanged] on [dbo].[InternationalCustomsInspectionDate]
after insert, update
as
set nocount on
    if( update( InspectionStartEstimatedDate ) or update( InspectionStartActualDate ) or
        update( InspectionEndEstimatedDate ) or update( InspectionEndActualDate )
    )
    begin
        update ToDo set
            ToDo.DueDate = dbo.udfTaskDueDate( ToDo.duetype, ToDo.duedays, dbo.GetInternationalCustomsInspectionDateByReportAndType( InternationalCustomsInspectionInformation.InternationalCustomsInspectionInformationID, DependencyDate.FieldName ) )
        from ToDo
        inner join InternationalCustomsInspectionInformation on InternationalCustomsInspectionInformation.OrdersFID = ToDo.OrderID
        inner join inserted on inserted.InternationalCustomsInspectionInformationFID = InternationalCustomsInspectionInformation.InternationalCustomsInspectionInformationID
        inner join DependencyDate on ToDo.DependencyDateID = DependencyDate.DependencyDateID
        where DependencyDate.TableName = 'InternationalCustomsInspectionDate'
    end
GO
ALTER TABLE [dbo].[InternationalCustomsInspectionDate] ADD CONSTRAINT [PK_InternationalCustomsInspectionDate] PRIMARY KEY NONCLUSTERED  ([InternationalCustomsInspectionDateID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalCustomsInspectionDate] ADD CONSTRAINT [IX_InternationalCustomsInspectionDate_InternationalCustomsInspectionInformationFID] UNIQUE CLUSTERED  ([InternationalCustomsInspectionInformationFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalCustomsInspectionDate] ADD CONSTRAINT [FK_InternationalCustomsInspectionDate_InternationalCustomsInspectionInformation] FOREIGN KEY ([InternationalCustomsInspectionInformationFID]) REFERENCES [dbo].[InternationalCustomsInspectionInformation] ([InternationalCustomsInspectionInformationID])
GO
GRANT SELECT ON  [dbo].[InternationalCustomsInspectionDate] TO [MssExec]
GRANT INSERT ON  [dbo].[InternationalCustomsInspectionDate] TO [MssExec]
GRANT DELETE ON  [dbo].[InternationalCustomsInspectionDate] TO [MssExec]
GRANT UPDATE ON  [dbo].[InternationalCustomsInspectionDate] TO [MssExec]
GO
Uses