Tables [dbo].[InternationalBookingNumberDate]
Properties
PropertyValue
Row Count (~)0
Created9:06:37 AM Friday, December 7, 2018
Last Modified9:06:54 AM Friday, December 7, 2018
Columns
NameData TypeMax Length (Bytes)Allow NullsIdentity
Primary Key PK_InternationalBookingNumberDate: InternationalBookingNumberDateIDInternationalBookingNumberDateIDint4
No
1 - 1
Cluster Key IX_InternationalBookingNumberDate_OrdersFID: OrdersFIDForeign Keys FK_InternationalBookingNumberDate_Orders: [dbo].[Orders].OrdersFIDOrdersFIDint4
No
PickupEstimatedDatedatetime8
Yes
PickupActualDatedatetime8
Yes
ReturnEstimatedDatedatetime8
Yes
ReturnActualDatedatetime8
Yes
Indexes Indexes
NameColumnsUnique
Primary Key PK_InternationalBookingNumberDate: InternationalBookingNumberDateIDPK_InternationalBookingNumberDateInternationalBookingNumberDateID
Yes
Cluster Key IX_InternationalBookingNumberDate_OrdersFID: OrdersFIDIX_InternationalBookingNumberDate_OrdersFIDOrdersFID
Yes
Triggers Triggers
NameANSI Nulls OnQuoted Identifier OnOn
InternationalBookingNumberDateTaskFieldChanged
Yes
Yes
After Insert Update
Foreign Keys Foreign Keys
NameColumns
FK_InternationalBookingNumberDate_OrdersOrdersFID->[dbo].[Orders].[PriKey]
Permissions
TypeActionOwning Principal
GrantDeleteMssExec
GrantInsertMssExec
GrantSelectMssExec
GrantUpdateMssExec
SQL Script
CREATE TABLE [dbo].[InternationalBookingNumberDate]
(
[InternationalBookingNumberDateID] [int] NOT NULL IDENTITY(1, 1),
[OrdersFID] [int] NOT NULL,
[PickupEstimatedDate] [datetime] NULL,
[PickupActualDate] [datetime] NULL,
[ReturnEstimatedDate] [datetime] NULL,
[ReturnActualDate] [datetime] NULL
) ON [PRIMARY]
GO

create trigger [dbo].[InternationalBookingNumberDateTaskFieldChanged] on [dbo].[InternationalBookingNumberDate]
after insert, update
as
set nocount on
    if( update( PickupEstimatedDate ) or update( PickupActualDate ) or
        update( ReturnEstimatedDate ) or update( ReturnActualDate )
    )
    begin
        update ToDo set
            ToDo.DueDate = dbo.udfTaskDueDate( ToDo.duetype, ToDo.duedays, dbo.GetInternationalBookingNumberDateByOrderAndType( ToDo.OrderID, DependencyDate.FieldName ) )
        from ToDo
        inner join inserted on inserted.OrdersFID = ToDo.OrderID
        inner join DependencyDate on ToDo.DependencyDateID = DependencyDate.DependencyDateID
        where DependencyDate.TableName = 'InternationalBookingNumberDate'
    end
GO
ALTER TABLE [dbo].[InternationalBookingNumberDate] ADD CONSTRAINT [PK_InternationalBookingNumberDate] PRIMARY KEY NONCLUSTERED  ([InternationalBookingNumberDateID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalBookingNumberDate] ADD CONSTRAINT [IX_InternationalBookingNumberDate_OrdersFID] UNIQUE CLUSTERED  ([OrdersFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalBookingNumberDate] ADD CONSTRAINT [FK_InternationalBookingNumberDate_Orders] FOREIGN KEY ([OrdersFID]) REFERENCES [dbo].[Orders] ([PriKey])
GO
GRANT SELECT ON  [dbo].[InternationalBookingNumberDate] TO [MssExec]
GRANT INSERT ON  [dbo].[InternationalBookingNumberDate] TO [MssExec]
GRANT DELETE ON  [dbo].[InternationalBookingNumberDate] TO [MssExec]
GRANT UPDATE ON  [dbo].[InternationalBookingNumberDate] TO [MssExec]
GO
Uses