Tables [dbo].[arg_model_pricing]
Properties
PropertyValue
Row Count0
Created10:33:14 PM Thursday, February 10, 2011
Last Modified5:14:21 PM Tuesday, April 26, 2011
Columns
NameData TypeCollationMax Length (Bytes)Allow NullsDefault
Cluster Primary Key pk_arg_model_pricing: pricing_idpricing_idbigint8
No
Foreign Keys FK_ARG_MODEL_PRICING_MODEL: [dbo].[ca_model_def].model_uuidIndexes arg_model_pricing_idx_01: model_uuidmodel_uuidbinary(16)16
No
begin_datedatetime8
Yes
expiration_datedatetime8
Yes
pricing_amountfloat8
Yes
Foreign Keys FK_ARG_MODEL_PRICING_CURRENCY: [dbo].[ca_currency_type].currency_type_codecurrency_type_codevarchar(3)SQL_Latin1_General_CP1_CS_AS3
Yes
Foreign Keys FK_ARG_MODEL_PRICING_TYPE: [dbo].[arg_pricing_type].pricing_type_idpricing_type_idbigint8
Yes
part_numbernvarchar(100)SQL_Latin1_General_CP1_CI_AS200
Yes
Foreign Keys FK_ARG_MODEL_PRICING_RESELLER: [dbo].[ca_company].reseller_uuidreseller_uuidbinary(16)16
Yes
pricing_commentnvarchar(255)SQL_Latin1_General_CP1_CI_AS510
Yes
creation_usernvarchar(255)SQL_Latin1_General_CP1_CI_AS510
Yes
creation_dateint4
Yes
last_update_usernvarchar(255)SQL_Latin1_General_CP1_CI_AS510
Yes
last_update_dateint4
Yes
version_numberint4
Yes
('0 ')
Foreign Keys FK_ARG_MODEL_PRICING_TENANT: [dbo].[ca_tenant].tenanttenantbinary(16)16
Yes
is_manufacturer_part_numberint4
Yes
Indexes Indexes
NameColumnsUnique
Cluster Primary Key pk_arg_model_pricing: pricing_idpk_arg_model_pricingpricing_id
Yes
arg_model_pricing_idx_01model_uuid
Triggers Triggers
NameANSI Nulls OnQuoted Identifier OnOn
ca_tr_del_arg_model_pricing
Yes
Yes
After Delete
ca_tr_ins_arg_model_pricing
Yes
Yes
After Insert
ca_tr_upd_arg_model_pricing
Yes
Yes
After Update
Foreign Keys Foreign Keys
NameColumns
FK_ARG_MODEL_PRICING_CURRENCYcurrency_type_code->[dbo].[ca_currency_type].[currency_type_code]
FK_ARG_MODEL_PRICING_MODELmodel_uuid->[dbo].[ca_model_def].[model_uuid]
FK_ARG_MODEL_PRICING_RESELLERreseller_uuid->[dbo].[ca_company].[company_uuid]
FK_ARG_MODEL_PRICING_TENANTtenant->[dbo].[ca_tenant].[id]
FK_ARG_MODEL_PRICING_TYPEpricing_type_id->[dbo].[arg_pricing_type].[id]
SQL Script
CREATE TABLE [dbo].[arg_model_pricing]
(
[pricing_id] [bigint] NOT NULL,
[model_uuid] [binary] (16) NOT NULL,
[begin_date] [datetime] NULL,
[expiration_date] [datetime] NULL,
[pricing_amount] [float] NULL,
[currency_type_code] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CS_AS NULL,
[pricing_type_id] [bigint] NULL,
[part_number] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[reseller_uuid] [binary] (16) NULL,
[pricing_comment] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[creation_user] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[creation_date] [int] NULL,
[last_update_user] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[last_update_date] [int] NULL,
[version_number] [int] NULL CONSTRAINT [DF__ARG_MODEL__VERSI__629A9179] DEFAULT ('0 '),
[tenant] [binary] (16) NULL,
[is_manufacturer_part_number] [int] NULL
) ON [PRIMARY]

GO
CREATE TRIGGER dbo.ca_tr_del_arg_model_pricing
ON dbo.arg_model_pricing
FOR DELETE AS
DECLARE
        @audit_product nvarchar(64)
        SET @audit_product = APP_NAME()
INSERT INTO dbo.aud_arg_model_pricing (
AUDIT_TRAIL_PRODUCT,
AUDIT_TRAIL_USER,
AUDIT_TRAIL_TYPE,
AUDIT_TRAIL_DATE,
pricing_id,
model_uuid,
begin_date,
expiration_date,
pricing_amount,
currency_type_code,
pricing_type_id,
part_number,
reseller_uuid,
pricing_comment,
creation_user,
creation_date,
last_update_user,
last_update_date,
version_number,
tenant,
is_manufacturer_part_number) SELECT

@audit_product,old.last_update_user, 'DELETE', datediff(ss, '1/1/1970', getutcdate()),
old.pricing_id,
old.model_uuid,
old.begin_date,
old.expiration_date,
old.pricing_amount,
old.currency_type_code,
old.pricing_type_id,
old.part_number,
old.reseller_uuid,
old.pricing_comment,
old.creation_user,
old.creation_date,
old.last_update_user,
old.last_update_date,
old.version_number,
old.tenant,
old.is_manufacturer_part_number
FROM deleted old
GO
CREATE TRIGGER dbo.ca_tr_ins_arg_model_pricing
ON dbo.arg_model_pricing
FOR INSERT AS
DECLARE
        @audit_product nvarchar(64)
        SET @audit_product = APP_NAME()
INSERT INTO dbo.aud_arg_model_pricing (
AUDIT_TRAIL_PRODUCT,
AUDIT_TRAIL_USER,
AUDIT_TRAIL_TYPE,
AUDIT_TRAIL_DATE,
pricing_id,
model_uuid,
begin_date,
expiration_date,
pricing_amount,
currency_type_code,
pricing_type_id,
part_number,
reseller_uuid,
pricing_comment,
creation_user,
creation_date,
last_update_user,
last_update_date,
version_number,
tenant,
is_manufacturer_part_number) SELECT

@audit_product, new.last_update_user, 'INSERT', datediff(ss, '1/1/1970', getutcdate()),
new.pricing_id,
new.model_uuid,
new.begin_date,
new.expiration_date,
new.pricing_amount,
new.currency_type_code,
new.pricing_type_id,
new.part_number,
new.reseller_uuid,
new.pricing_comment,
new.creation_user,
new.creation_date,
new.last_update_user,
new.last_update_date,
new.version_number,
new.tenant,
new.is_manufacturer_part_number
FROM inserted new
GO
CREATE TRIGGER dbo.ca_tr_upd_arg_model_pricing
ON dbo.arg_model_pricing
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_model_pricing (
AUDIT_TRAIL_PRODUCT,
AUDIT_TRAIL_USER,
AUDIT_TRAIL_TYPE,
AUDIT_TRAIL_DATE,
pricing_id,
model_uuid,
begin_date,
expiration_date,
pricing_amount,
currency_type_code,
pricing_type_id,
part_number,
reseller_uuid,
pricing_comment,
creation_user,
creation_date,
last_update_user,
last_update_date,
version_number,
tenant,
is_manufacturer_part_number) SELECT

@audit_product, new.last_update_user, 'UPDATE', datediff(ss, '1/1/1970', getutcdate()),
new.pricing_id,
new.model_uuid,
new.begin_date,
new.expiration_date,
new.pricing_amount,
new.currency_type_code,
new.pricing_type_id,
new.part_number,
new.reseller_uuid,
new.pricing_comment,
new.creation_user,
new.creation_date,
new.last_update_user,
new.last_update_date,
new.version_number,
new.tenant,
new.is_manufacturer_part_number
  FROM inserted new
GO
ALTER TABLE [dbo].[arg_model_pricing] ADD CONSTRAINT [pk_arg_model_pricing] PRIMARY KEY CLUSTERED ([pricing_id]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [arg_model_pricing_idx_01] ON [dbo].[arg_model_pricing] ([model_uuid]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[arg_model_pricing] ADD CONSTRAINT [FK_ARG_MODEL_PRICING_CURRENCY] FOREIGN KEY ([currency_type_code]) REFERENCES [dbo].[ca_currency_type] ([currency_type_code])
GO
ALTER TABLE [dbo].[arg_model_pricing] ADD CONSTRAINT [FK_ARG_MODEL_PRICING_MODEL] FOREIGN KEY ([model_uuid]) REFERENCES [dbo].[ca_model_def] ([model_uuid])
GO
ALTER TABLE [dbo].[arg_model_pricing] ADD CONSTRAINT [FK_ARG_MODEL_PRICING_RESELLER] FOREIGN KEY ([reseller_uuid]) REFERENCES [dbo].[ca_company] ([company_uuid])
GO
ALTER TABLE [dbo].[arg_model_pricing] ADD CONSTRAINT [FK_ARG_MODEL_PRICING_TENANT] FOREIGN KEY ([tenant]) REFERENCES [dbo].[ca_tenant] ([id])
GO
ALTER TABLE [dbo].[arg_model_pricing] ADD CONSTRAINT [FK_ARG_MODEL_PRICING_TYPE] FOREIGN KEY ([pricing_type_id]) REFERENCES [dbo].[arg_pricing_type] ([id])
GO
Uses
Used By