Tables [dbo].[arg_legaldoc]
Properties
PropertyValue
CollationSQL_Latin1_General_CP1_CI_AS
Row Count23
Created12:30:44 PM Sunday, December 05, 2010
Last Modified5:14:16 PM Tuesday, April 26, 2011
Columns
NameData TypeMax Length (Bytes)Allow NullsDefault
Cluster Primary Key XPKarg_legaldoc: legaldoc_uuidlegaldoc_uuidbinary(16)16
No
Foreign Keys LELGJOIN01: [dbo].[arg_legaldef].lelgidlelgidbigint8
Yes
Foreign Keys LECOJOIN01: [dbo].[ca_company].external_company_uuidIndexes leindex03: external_company_uuidexternal_company_uuidbinary(16)16
Yes
Foreign Keys LECOJOIN02: [dbo].[ca_company].internal_company_uuidinternal_company_uuidbinary(16)16
Yes
Indexes leindex04: ledocidnledocidnnvarchar(50)100
Yes
Foreign Keys LEINJOIN01: [dbo].[ca_contact].negotiator_contact_uuidnegotiator_contact_uuidbinary(16)16
Yes
ledescnvarchar(100)200
Yes
leeffdtdatetime8
Yes
letermdtdatetime8
Yes
Foreign Keys LEDLJOIN02: [dbo].[arg_dl_doc_location].ledoclocledoclocbigint8
Yes
leelelocnvarchar(50)100
Yes
leinactsmallint2
Yes
((0))
lestatdtdatetime8
Yes
Foreign Keys LEDLJOIN01: [dbo].[arg_dl_legal_status].lestatuslestatusbigint8
Yes
Foreign Keys LEINJOIN02: [dbo].[ca_contact].requestor_contact_uuidIndexes leindex05: requestor_contact_uuid\vendor_contact_uuidrequestor_contact_uuidbinary(16)16
Yes
Foreign Keys LEINJOIN03: [dbo].[ca_contact].vendor_contact_uuidIndexes leindex05: requestor_contact_uuid\vendor_contact_uuidvendor_contact_uuidbinary(16)16
Yes
Foreign Keys LESLJOIN01: [dbo].[arg_sl_contract_used].lecnusedlecnusedsmallint2
Yes
Foreign Keys LEGLCJOIN01: [dbo].[ca_resource_gl_code].gl_codegl_codeint4
Yes
Foreign Keys LERCCJOIN01: [dbo].[ca_resource_cost_center].cost_centercost_centerint4
Yes
creation_usernvarchar(64)128
Yes
creation_dateint4
Yes
last_update_usernvarchar(64)128
Yes
last_update_dateint4
Yes
version_numberint4
Yes
('0')
Foreign Keys LEORGJOIN01: [dbo].[ca_organization].organization_uuidorganization_uuidbinary(16)16
Yes
Foreign Keys LEINJOIN04: [dbo].[ca_contact].owner_uuidowner_uuidbinary(16)16
Yes
Foreign Keys LEINJOIN05: [dbo].[ca_contact].manager_uuidmanager_uuidbinary(16)16
Yes
Foreign Keys LEINJOIN06: [dbo].[ca_contact].cost_approver_uuidcost_approver_uuidbinary(16)16
Yes
Foreign Keys FK_ARG_LEGALDOC_TENANT: [dbo].[ca_tenant].tenanttenantbinary(16)16
Yes
Indexes Indexes
NameColumnsUnique
Cluster Primary Key XPKarg_legaldoc: legaldoc_uuidXPKarg_legaldoclegaldoc_uuid
Yes
leindex03external_company_uuid
leindex04ledocidn
leindex05requestor_contact_uuid, vendor_contact_uuid
Triggers Triggers
NameANSI Nulls OnQuoted Identifier OnOn
ca_tr_del_arg_legaldoc
Yes
Yes
After Delete
ca_tr_ins_arg_legaldoc
Yes
Yes
After Insert
ca_tr_upd_arg_legaldoc
Yes
Yes
After Update
Foreign Keys Foreign Keys
NameColumns
FK_ARG_LEGALDOC_TENANTtenant->[dbo].[ca_tenant].[id]
LECOJOIN01external_company_uuid->[dbo].[ca_company].[company_uuid]
LECOJOIN02internal_company_uuid->[dbo].[ca_company].[company_uuid]
LEDLJOIN01lestatus->[dbo].[arg_dl_legal_status].[id]
LEDLJOIN02ledocloc->[dbo].[arg_dl_doc_location].[id]
LEGLCJOIN01gl_code->[dbo].[ca_resource_gl_code].[id]
LEINJOIN01negotiator_contact_uuid->[dbo].[ca_contact].[contact_uuid]
LEINJOIN02requestor_contact_uuid->[dbo].[ca_contact].[contact_uuid]
LEINJOIN03vendor_contact_uuid->[dbo].[ca_contact].[contact_uuid]
LEINJOIN04owner_uuid->[dbo].[ca_contact].[contact_uuid]
LEINJOIN05manager_uuid->[dbo].[ca_contact].[contact_uuid]
LEINJOIN06cost_approver_uuid->[dbo].[ca_contact].[contact_uuid]
LELGJOIN01lelgid->[dbo].[arg_legaldef].[lgid]
LEORGJOIN01organization_uuid->[dbo].[ca_organization].[organization_uuid]
LERCCJOIN01cost_center->[dbo].[ca_resource_cost_center].[id]
LESLJOIN01lecnused->[dbo].[arg_sl_contract_used].[id]
Permissions
TypeActionOwning Principal
GrantDeleteswcmadmin
GrantInsertswcmadmin
GrantSelectamsgroup
GrantSelectca_itrm_group
GrantSelectca_itrm_group_ams
GrantSelectswcmadmin
GrantUpdateswcmadmin
SQL Script
CREATE TABLE [dbo].[arg_legaldoc]
(
[legaldoc_uuid] [binary] (16) NOT NULL,
[lelgid] [bigint] NULL,
[external_company_uuid] [binary] (16) NULL,
[internal_company_uuid] [binary] (16) NULL,
[ledocidn] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[negotiator_contact_uuid] [binary] (16) NULL,
[ledesc] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[leeffdt] [datetime] NULL,
[letermdt] [datetime] NULL,
[ledocloc] [bigint] NULL,
[leeleloc] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[leinact] [smallint] NULL CONSTRAINT [DF__arg_legal__leina__21BF8D71] DEFAULT ((0)),
[lestatdt] [datetime] NULL,
[lestatus] [bigint] NULL,
[requestor_contact_uuid] [binary] (16) NULL,
[vendor_contact_uuid] [binary] (16) NULL,
[lecnused] [smallint] NULL,
[gl_code] [int] NULL,
[cost_center] [int] 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__arg_legal__versi__3CBF0154] DEFAULT ('0'),
[organization_uuid] [binary] (16) NULL,
[owner_uuid] [binary] (16) NULL,
[manager_uuid] [binary] (16) NULL,
[cost_approver_uuid] [binary] (16) NULL,
[tenant] [binary] (16) NULL
) ON [PRIMARY]

GO
CREATE TRIGGER dbo.ca_tr_del_arg_legaldoc
ON dbo.arg_legaldoc
FOR DELETE AS
DECLARE
        @audit_product nvarchar(64)
        SET @audit_product = APP_NAME()
INSERT INTO dbo.aud_arg_legaldoc (
AUDIT_TRAIL_PRODUCT,
AUDIT_TRAIL_USER,
AUDIT_TRAIL_TYPE,
AUDIT_TRAIL_DATE,
legaldoc_uuid,
lelgid,
external_company_uuid,
internal_company_uuid,
ledocidn,
negotiator_contact_uuid,
ledesc,
leeffdt,
letermdt,
ledocloc,
leeleloc,
leinact,
lestatdt,
lestatus,
requestor_contact_uuid,
vendor_contact_uuid,
lecnused,
gl_code,
cost_center,
creation_user,
creation_date,
last_update_user,
last_update_date,
version_number,
organization_uuid,
owner_uuid,
manager_uuid,
cost_approver_uuid,
tenant) SELECT

@audit_product,old.last_update_user, 'DELETE', datediff(ss, '1/1/1970', getutcdate()),
old.legaldoc_uuid,
old.lelgid,
old.external_company_uuid,
old.internal_company_uuid,
old.ledocidn,
old.negotiator_contact_uuid,
old.ledesc,
old.leeffdt,
old.letermdt,
old.ledocloc,
old.leeleloc,
old.leinact,
old.lestatdt,
old.lestatus,
old.requestor_contact_uuid,
old.vendor_contact_uuid,
old.lecnused,
old.gl_code,
old.cost_center,
old.creation_user,
old.creation_date,
old.last_update_user,
old.last_update_date,
old.version_number,
old.organization_uuid,
old.owner_uuid,
old.manager_uuid,
old.cost_approver_uuid,
old.tenant
FROM deleted old
GO
CREATE TRIGGER dbo.ca_tr_ins_arg_legaldoc
ON dbo.arg_legaldoc
FOR INSERT AS
DECLARE
        @audit_product nvarchar(64)
        SET @audit_product = APP_NAME()
INSERT INTO dbo.aud_arg_legaldoc (
AUDIT_TRAIL_PRODUCT,
AUDIT_TRAIL_USER,
AUDIT_TRAIL_TYPE,
AUDIT_TRAIL_DATE,
legaldoc_uuid,
lelgid,
external_company_uuid,
internal_company_uuid,
ledocidn,
negotiator_contact_uuid,
ledesc,
leeffdt,
letermdt,
ledocloc,
leeleloc,
leinact,
lestatdt,
lestatus,
requestor_contact_uuid,
vendor_contact_uuid,
lecnused,
gl_code,
cost_center,
creation_user,
creation_date,
last_update_user,
last_update_date,
version_number,
organization_uuid,
owner_uuid,
manager_uuid,
cost_approver_uuid,
tenant) SELECT

@audit_product, new.last_update_user, 'INSERT', datediff(ss, '1/1/1970', getutcdate()),
new.legaldoc_uuid,
new.lelgid,
new.external_company_uuid,
new.internal_company_uuid,
new.ledocidn,
new.negotiator_contact_uuid,
new.ledesc,
new.leeffdt,
new.letermdt,
new.ledocloc,
new.leeleloc,
new.leinact,
new.lestatdt,
new.lestatus,
new.requestor_contact_uuid,
new.vendor_contact_uuid,
new.lecnused,
new.gl_code,
new.cost_center,
new.creation_user,
new.creation_date,
new.last_update_user,
new.last_update_date,
new.version_number,
new.organization_uuid,
new.owner_uuid,
new.manager_uuid,
new.cost_approver_uuid,
new.tenant
FROM inserted new
GO
CREATE TRIGGER dbo.ca_tr_upd_arg_legaldoc
ON dbo.arg_legaldoc
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_arg_legaldoc (
AUDIT_TRAIL_PRODUCT,
AUDIT_TRAIL_USER,
AUDIT_TRAIL_TYPE,
AUDIT_TRAIL_DATE,
legaldoc_uuid,
lelgid,
external_company_uuid,
internal_company_uuid,
ledocidn,
negotiator_contact_uuid,
ledesc,
leeffdt,
letermdt,
ledocloc,
leeleloc,
leinact,
lestatdt,
lestatus,
requestor_contact_uuid,
vendor_contact_uuid,
lecnused,
gl_code,
cost_center,
creation_user,
creation_date,
last_update_user,
last_update_date,
version_number,
organization_uuid,
owner_uuid,
manager_uuid,
cost_approver_uuid,
tenant) SELECT

@audit_product, new.last_update_user, 'UPDATE', datediff(ss, '1/1/1970', getutcdate()),
new.legaldoc_uuid,
new.lelgid,
new.external_company_uuid,
new.internal_company_uuid,
new.ledocidn,
new.negotiator_contact_uuid,
new.ledesc,
new.leeffdt,
new.letermdt,
new.ledocloc,
new.leeleloc,
new.leinact,
new.lestatdt,
new.lestatus,
new.requestor_contact_uuid,
new.vendor_contact_uuid,
new.lecnused,
new.gl_code,
new.cost_center,
new.creation_user,
new.creation_date,
new.last_update_user,
new.last_update_date,
new.version_number,
new.organization_uuid,
new.owner_uuid,
new.manager_uuid,
new.cost_approver_uuid,
new.tenant
  FROM inserted new
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [XPKarg_legaldoc] PRIMARY KEY CLUSTERED ([legaldoc_uuid]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [leindex03] ON [dbo].[arg_legaldoc] ([external_company_uuid]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [leindex04] ON [dbo].[arg_legaldoc] ([ledocidn]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [leindex05] ON [dbo].[arg_legaldoc] ([requestor_contact_uuid], [vendor_contact_uuid]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [FK_ARG_LEGALDOC_TENANT] FOREIGN KEY ([tenant]) REFERENCES [dbo].[ca_tenant] ([id])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LECOJOIN01] FOREIGN KEY ([external_company_uuid]) REFERENCES [dbo].[ca_company] ([company_uuid])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LECOJOIN02] FOREIGN KEY ([internal_company_uuid]) REFERENCES [dbo].[ca_company] ([company_uuid])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LEDLJOIN01] FOREIGN KEY ([lestatus]) REFERENCES [dbo].[arg_dl_legal_status] ([id])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LEDLJOIN02] FOREIGN KEY ([ledocloc]) REFERENCES [dbo].[arg_dl_doc_location] ([id])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LEGLCJOIN01] FOREIGN KEY ([gl_code]) REFERENCES [dbo].[ca_resource_gl_code] ([id])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LEINJOIN01] FOREIGN KEY ([negotiator_contact_uuid]) REFERENCES [dbo].[ca_contact] ([contact_uuid])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LEINJOIN02] FOREIGN KEY ([requestor_contact_uuid]) REFERENCES [dbo].[ca_contact] ([contact_uuid])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LEINJOIN03] FOREIGN KEY ([vendor_contact_uuid]) REFERENCES [dbo].[ca_contact] ([contact_uuid])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LEINJOIN04] FOREIGN KEY ([owner_uuid]) REFERENCES [dbo].[ca_contact] ([contact_uuid])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LEINJOIN05] FOREIGN KEY ([manager_uuid]) REFERENCES [dbo].[ca_contact] ([contact_uuid])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LEINJOIN06] FOREIGN KEY ([cost_approver_uuid]) REFERENCES [dbo].[ca_contact] ([contact_uuid])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LELGJOIN01] FOREIGN KEY ([lelgid]) REFERENCES [dbo].[arg_legaldef] ([lgid])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LEORGJOIN01] FOREIGN KEY ([organization_uuid]) REFERENCES [dbo].[ca_organization] ([organization_uuid])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LERCCJOIN01] FOREIGN KEY ([cost_center]) REFERENCES [dbo].[ca_resource_cost_center] ([id])
GO
ALTER TABLE [dbo].[arg_legaldoc] ADD CONSTRAINT [LESLJOIN01] FOREIGN KEY ([lecnused]) REFERENCES [dbo].[arg_sl_contract_used] ([id])
GO
GRANT SELECT ON  [dbo].[arg_legaldoc] TO [amsgroup]
GRANT SELECT ON  [dbo].[arg_legaldoc] TO [ca_itrm_group]
GRANT SELECT ON  [dbo].[arg_legaldoc] TO [ca_itrm_group_ams]
GRANT SELECT ON  [dbo].[arg_legaldoc] TO [swcmadmin]
GRANT INSERT ON  [dbo].[arg_legaldoc] TO [swcmadmin]
GRANT DELETE ON  [dbo].[arg_legaldoc] TO [swcmadmin]
GRANT UPDATE ON  [dbo].[arg_legaldoc] TO [swcmadmin]
GO
Uses
Used By