Tables [dbo].[al_costdet]
Properties
PropertyValue
Row Count83
Created10:33:02 PM Thursday, February 10, 2011
Last Modified5:14:21 PM Tuesday, April 26, 2011
Columns
NameData TypeCollationMax Length (Bytes)Allow NullsDefault
cdbegdtdatetime8
Yes
cdividsmallint2
Yes
cduntamtfloat8
Yes
Foreign Keys CDCOJOIN02: [dbo].[ca_company].company_uuidIndexes al_costdet_idx01: company_uuidcompany_uuidbinary(16)16
Yes
Foreign Keys CDDLJOIN06: [dbo].[arg_dl_billing_code].cdbillcdcdbillcdbigint8
Yes
cdcommntnvarchar(255)SQL_Latin1_General_CP1_CI_AS510
Yes
Foreign Keys CDSLJOIN06: [dbo].[arg_sl_recurring_period].cdreuntcdreuntsmallint2
Yes
cdretmdtdatetime8
Yes
cdreactsmallint2
Yes
cdrecapsmallint2
Yes
cdreespcfloat8
Yes
Foreign Keys CDRCCJOIN02: [dbo].[ca_resource_cost_center].cost_centercost_centerint4
Yes
cdcurrtysmallint2
Yes
Foreign Keys CDDLJOIN05: [dbo].[arg_dl_cost_type].cdtypecdtypebigint8
Yes
Foreign Keys CDGLCJOIN02: [dbo].[ca_resource_gl_code].gl_codegl_codeint4
Yes
cdpaytypesmallint2
Yes
cdpaytotfloat8
Yes
creation_usernvarchar(64)SQL_Latin1_General_CP1_CI_AS128
Yes
creation_dateint4
Yes
last_update_usernvarchar(64)SQL_Latin1_General_CP1_CI_AS128
Yes
last_update_dateint4
Yes
version_numberint4
Yes
('0  ')
cdamtperint4
Yes
cdreperint4
Yes
part_numbernvarchar(255)SQL_Latin1_General_CP1_CI_AS510
Yes
Cluster Primary Key xpkal_costdet: cost_idcost_idbigint8
No
Foreign Keys CDCTJOIN02: [dbo].[ca_currency_type].currency_type_codecurrency_type_codevarchar(3)SQL_Latin1_General_CP1_CS_AS3
Yes
Foreign Keys FK_AL_COSTDET_TENANT: [dbo].[ca_tenant].tenanttenantbinary(16)16
Yes
Indexes Indexes
NameColumnsUnique
Cluster Primary Key xpkal_costdet: cost_idxpkal_costdetcost_id
Yes
al_costdet_idx01company_uuid
Triggers Triggers
NameANSI Nulls OnQuoted Identifier OnOn
ca_tr_del_al_costdet
Yes
Yes
After Delete
ca_tr_ins_al_costdet
Yes
Yes
After Insert
ca_tr_upd_al_costdet
Yes
Yes
After Update
Foreign Keys Foreign Keys
NameColumns
CDCOJOIN02company_uuid->[dbo].[ca_company].[company_uuid]
CDCTJOIN02currency_type_code->[dbo].[ca_currency_type].[currency_type_code]
CDDLJOIN05cdtype->[dbo].[arg_dl_cost_type].[id]
CDDLJOIN06cdbillcd->[dbo].[arg_dl_billing_code].[id]
CDGLCJOIN02gl_code->[dbo].[ca_resource_gl_code].[id]
CDRCCJOIN02cost_center->[dbo].[ca_resource_cost_center].[id]
CDSLJOIN06cdreunt->[dbo].[arg_sl_recurring_period].[id]
FK_AL_COSTDET_TENANTtenant->[dbo].[ca_tenant].[id]
SQL Script
CREATE TABLE [dbo].[al_costdet]
(
[cdbegdt] [datetime] NULL,
[cdivid] [smallint] NULL,
[cduntamt] [float] NULL,
[company_uuid] [binary] (16) NULL,
[cdbillcd] [bigint] NULL,
[cdcommnt] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[cdreunt] [smallint] NULL,
[cdretmdt] [datetime] NULL,
[cdreact] [smallint] NULL,
[cdrecap] [smallint] NULL,
[cdreespc] [float] NULL,
[cost_center] [int] NULL,
[cdcurrty] [smallint] NULL,
[cdtype] [bigint] NULL,
[gl_code] [int] NULL,
[cdpaytype] [smallint] NULL,
[cdpaytot] [float] NULL,
[creation_user] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[creation_date] [int] NULL,
[last_update_user] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[last_update_date] [int] NULL,
[version_number] [int] NULL CONSTRAINT [DF__AL_COSTD__VERSI__05A3D694] DEFAULT ('0  '),
[cdamtper] [int] NULL,
[cdreper] [int] NULL,
[part_number] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[cost_id] [bigint] NOT NULL,
[currency_type_code] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CS_AS NULL,
[tenant] [binary] (16) NULL
) ON [PRIMARY]

GO
CREATE TRIGGER dbo.ca_tr_del_al_costdet
ON dbo.al_costdet
FOR DELETE AS
DECLARE
        @audit_product nvarchar(64)
        SET @audit_product = APP_NAME()
INSERT INTO dbo.aud_al_costdet (
AUDIT_TRAIL_PRODUCT,
AUDIT_TRAIL_USER,
AUDIT_TRAIL_TYPE,
AUDIT_TRAIL_DATE,
cdbegdt,
cdivid,
cduntamt,
company_uuid,
cdbillcd,
cdcommnt,
cdreunt,
cdretmdt,
cdreact,
cdrecap,
cdreespc,
cost_center,
cdcurrty,
cdtype,
gl_code,
cdpaytype,
cdpaytot,
creation_user,
creation_date,
last_update_user,
last_update_date,
version_number,
cdamtper,
cdreper,
part_number,
cost_id,
currency_type_code,
tenant) SELECT

@audit_product,old.last_update_user, 'DELETE', datediff(ss, '1/1/1970', getutcdate()),
old.cdbegdt,
old.cdivid,
old.cduntamt,
old.company_uuid,
old.cdbillcd,
old.cdcommnt,
old.cdreunt,
old.cdretmdt,
old.cdreact,
old.cdrecap,
old.cdreespc,
old.cost_center,
old.cdcurrty,
old.cdtype,
old.gl_code,
old.cdpaytype,
old.cdpaytot,
old.creation_user,
old.creation_date,
old.last_update_user,
old.last_update_date,
old.version_number,
old.cdamtper,
old.cdreper,
old.part_number,
old.cost_id,
old.currency_type_code,
old.tenant
FROM deleted old
GO
CREATE TRIGGER dbo.ca_tr_ins_al_costdet
ON dbo.al_costdet
FOR INSERT AS
DECLARE
        @audit_product nvarchar(64)
        SET @audit_product = APP_NAME()
INSERT INTO dbo.aud_al_costdet (
AUDIT_TRAIL_PRODUCT,
AUDIT_TRAIL_USER,
AUDIT_TRAIL_TYPE,
AUDIT_TRAIL_DATE,
cdbegdt,
cdivid,
cduntamt,
company_uuid,
cdbillcd,
cdcommnt,
cdreunt,
cdretmdt,
cdreact,
cdrecap,
cdreespc,
cost_center,
cdcurrty,
cdtype,
gl_code,
cdpaytype,
cdpaytot,
creation_user,
creation_date,
last_update_user,
last_update_date,
version_number,
cdamtper,
cdreper,
part_number,
cost_id,
currency_type_code,
tenant) SELECT

@audit_product, new.last_update_user, 'INSERT', datediff(ss, '1/1/1970', getutcdate()),
new.cdbegdt,
new.cdivid,
new.cduntamt,
new.company_uuid,
new.cdbillcd,
new.cdcommnt,
new.cdreunt,
new.cdretmdt,
new.cdreact,
new.cdrecap,
new.cdreespc,
new.cost_center,
new.cdcurrty,
new.cdtype,
new.gl_code,
new.cdpaytype,
new.cdpaytot,
new.creation_user,
new.creation_date,
new.last_update_user,
new.last_update_date,
new.version_number,
new.cdamtper,
new.cdreper,
new.part_number,
new.cost_id,
new.currency_type_code,
new.tenant
FROM inserted new
GO
CREATE TRIGGER dbo.ca_tr_upd_al_costdet
ON dbo.al_costdet
FOR UPDATE AS
DECLARE
        @audit_product nvarchar(64),
        @last_update_user nvarchar(64),
        @version_number int


        SET @audit_product = APP_NAME()
SELECT  @version_number = version_number, @last_update_user = last_update_user FROM inserted

IF @version_number != -1
INSERT INTO dbo.aud_al_costdet (
AUDIT_TRAIL_PRODUCT,
AUDIT_TRAIL_USER,
AUDIT_TRAIL_TYPE,
AUDIT_TRAIL_DATE,
cdbegdt,
cdivid,
cduntamt,
company_uuid,
cdbillcd,
cdcommnt,
cdreunt,
cdretmdt,
cdreact,
cdrecap,
cdreespc,
cost_center,
cdcurrty,
cdtype,
gl_code,
cdpaytype,
cdpaytot,
creation_user,
creation_date,
last_update_user,
last_update_date,
version_number,
cdamtper,
cdreper,
part_number,
cost_id,
currency_type_code,
tenant) SELECT

@audit_product, new.last_update_user, 'UPDATE', datediff(ss, '1/1/1970', getutcdate()),
new.cdbegdt,
new.cdivid,
new.cduntamt,
new.company_uuid,
new.cdbillcd,
new.cdcommnt,
new.cdreunt,
new.cdretmdt,
new.cdreact,
new.cdrecap,
new.cdreespc,
new.cost_center,
new.cdcurrty,
new.cdtype,
new.gl_code,
new.cdpaytype,
new.cdpaytot,
new.creation_user,
new.creation_date,
new.last_update_user,
new.last_update_date,
new.version_number,
new.cdamtper,
new.cdreper,
new.part_number,
new.cost_id,
new.currency_type_code,
new.tenant
  FROM inserted new
GO
ALTER TABLE [dbo].[al_costdet] ADD CONSTRAINT [xpkal_costdet] PRIMARY KEY CLUSTERED ([cost_id]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [al_costdet_idx01] ON [dbo].[al_costdet] ([company_uuid]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[al_costdet] ADD CONSTRAINT [CDCOJOIN02] FOREIGN KEY ([company_uuid]) REFERENCES [dbo].[ca_company] ([company_uuid])
GO
ALTER TABLE [dbo].[al_costdet] ADD CONSTRAINT [CDCTJOIN02] FOREIGN KEY ([currency_type_code]) REFERENCES [dbo].[ca_currency_type] ([currency_type_code])
GO
ALTER TABLE [dbo].[al_costdet] ADD CONSTRAINT [CDDLJOIN05] FOREIGN KEY ([cdtype]) REFERENCES [dbo].[arg_dl_cost_type] ([id])
GO
ALTER TABLE [dbo].[al_costdet] ADD CONSTRAINT [CDDLJOIN06] FOREIGN KEY ([cdbillcd]) REFERENCES [dbo].[arg_dl_billing_code] ([id])
GO
ALTER TABLE [dbo].[al_costdet] ADD CONSTRAINT [CDGLCJOIN02] FOREIGN KEY ([gl_code]) REFERENCES [dbo].[ca_resource_gl_code] ([id])
GO
ALTER TABLE [dbo].[al_costdet] ADD CONSTRAINT [CDRCCJOIN02] FOREIGN KEY ([cost_center]) REFERENCES [dbo].[ca_resource_cost_center] ([id])
GO
ALTER TABLE [dbo].[al_costdet] ADD CONSTRAINT [CDSLJOIN06] FOREIGN KEY ([cdreunt]) REFERENCES [dbo].[arg_sl_recurring_period] ([id])
GO
ALTER TABLE [dbo].[al_costdet] ADD CONSTRAINT [FK_AL_COSTDET_TENANT] FOREIGN KEY ([tenant]) REFERENCES [dbo].[ca_tenant] ([id])
GO
Uses
Used By