Trigger Help

  • I need to create 2 triggers that will update 1 main table. The main table is called bankruptcy and the 2 tables that I need triggers on are bankruptcy_event_log and Bankruptcy_stip_amount. I will paste the logic for the updates and the ddl below. If anyone can be of any help I would greatly appreciate this as this was handed down to me tonight and needs to be completed asap. Thanks.

    These 2 columns come from the stip_amount table where I would need a trigger after insert,update:

    FOR Bankruptcy – Payment Plan Start Date –

    min(bankruptcy_stip_amount.due_date) for each bankruptcy_id.

    FOR Bankruptcy – Payment Plan End Date -

    min(bankruptcy_stip_amount.due_date) for each bankruptcy_id.

    These 5 come from the event_log table where I would need a trigger also for after insert, update:

    FOR Bankruptcy – Motion for Relief – Filed Date - bankruptcy_event_log.actual_end_date where bankruptcy_event_desc = ‘MFR Filed’ and bankruptcy_event_status = ‘C’

    FOR Bankruptcy – Motion for Relief – Stay Lifted Date -

    bankruptcy_event_log.actual_end_date where bankruptcy_event_desc = ‘MFR Results’ and bankruptcy_event_status = ‘C’

    FOR Bankruptcy – Plan Confirmation Date -

    bankruptcy_event_log.actual_end_date where bankruptcy_event_desc = ‘Plan Confirmed’ and bankruptcy_event_status = ‘C’

    FOR Bankruptcy – Attorney Referral Date - here a getdate() would work for now

    FOR Bankruptcy – Proof of Claim Filing Date -

    bankruptcy_event_log.actual_end_date where bankruptcy_event_desc = ‘POC Filed’ and bankruptcy_event_status = ‘C’

    ddl:

    CREATE TABLE [dbo].[Bankruptcy_stip_amount](

    [bayview_loan_number] [varchar](20) NOT NULL,

    [bankruptcy_id] [numeric](18, 0) NOT NULL,

    [stip_id] [numeric](18, 0) NOT NULL,

    [Amount] [money] NULL,

    [DueDate] [datetime] NULL,

    [CheckNumber] [varchar](25) NULL,

    [ReceivedDate] [datetime] NULL,

    [DefaultDate] [datetime] NULL,

    [StipUnapplied] [money] NULL,

    [edit_date] [datetime] NULL CONSTRAINT [DF_Bankruptcy_stip_amount_edit_date] DEFAULT (getdate()),

    [edit_uid] [varchar](20) NULL CONSTRAINT [DF_Bankruptcy_stip_amount_edit_uid] DEFAULT (user_name()),

    [CheckDate] [datetime] NULL

    event_log:

    CREATE TABLE [dbo].[bankruptcy_event_log](

    [bayview_loan_number] [varchar](10) NOT NULL,

    [bankruptcy_id] [int] NOT NULL,

    [bankruptcy_event_log_id] [numeric](18, 0) NOT NULL CONSTRAINT [DF__bankruptc__bankr__12A8CBF7] DEFAULT (0),

    [bankruptcy_event_id] [int] NULL,

    [projected_end_date] [datetime] NULL,

    [actual_end_date] [datetime] NULL,

    [bankruptcy_event_status] [varchar](10) NULL,

    [bankruptcy_hold_start_date] [datetime] NULL,

    [bankruptcy_days_on_hold] [int] NULL,

    [reason_on_hold] [varchar](50) NULL,

    [bankruptcy_schedule_code] [varchar](4) NULL,

    [default_flag] [tinyint] NULL,

    [delay_reason] [int] NULL

    Main Bankruptcy Table:

    CREATE TABLE [dbo].[bankruptcy](

    [bayview_loan_number] [varchar](10) NOT NULL,

    [loan_id] [varchar](10) NOT NULL,

    [bankruptcy_id] [int] NOT NULL CONSTRAINT [DF__bankruptc__bankr__5B58970D] DEFAULT (0),

    [debtor_code] [varchar](4) NULL CONSTRAINT [DF_bankruptcy_debtor_code1__12] DEFAULT ('BORR'),

    [bankruptcy_chapter] [varchar](2) NOT NULL,

    [bk_coordinator_uid_curr] [varchar](20) NULL,

    [bk_coordinator_uid_orig] [varchar](20) NULL,

    [bankruptcy_file_date] [datetime] NULL,

    [case_number] [varchar](20) NULL,

    [trustee_id] [int] NULL,

    [debtor_attorney_id] [int] NULL,

    [interbay_attorney_id] [int] NULL,

    [judge_id] [int] NULL,

    [district_id] [int] NULL,

    [first_post_petition_date] [datetime] NULL,

    [next_post_petition_date] [datetime] NULL,

    [payor_code] [varchar](1) NULL,

    [bankruptcy_status] [varchar](1) NULL,

    [poc_amount] [money] NULL,

    [poc_date] [datetime] NULL,

    [bankruptcy_end_date] [datetime] NULL,

    [bankruptcy_end_type] [int] NULL,

    [notification_date] [datetime] NULL,

    [consent_due_date] [datetime] NULL,

    [trustee_next_due_date] [datetime] NULL,

    [bankruptcy_schedule_code] [varchar](4) NULL,

    [edit_uid] [varchar](20) NULL,

    [edit_date] [datetime] NULL,

    [interbay_bk_start_date] [datetime] NULL,

    [bk_coordinator_uid_prev] [varchar](10) NULL,

    [bankruptcy_proj_end_date] [datetime] NULL,

    [consent_comment] [text] NULL,

    [proj_end_hold_date] [datetime] NULL,

    [debtor_name_last] [varchar](40) NULL,

    [debtor_name_first] [varchar](30) NULL,

    [upb_at_filling] [money] NULL,

    [borrower_id] [int] NULL CONSTRAINT [DF_bankruptcy_borrower_id1__14] DEFAULT (1),

    [stipulation_amount] [money] NULL CONSTRAINT [DF_bankruptcy_stipulation1__14] DEFAULT (0),

    [unapplied_balance] [money] NULL CONSTRAINT [DF_bankruptcy_unapplied_b2__14] DEFAULT (0),

    [stipulation_start_date] [datetime] NULL,

    [real_postp_date] [bit] NOT NULL CONSTRAINT [DF_bankruptcy_real_date] DEFAULT (1),

    [legal_status_prev] [varchar](8) NULL,

    [warning] [numeric](18, 0) NULL,

    [warning_date] [datetime] NULL,

    [Payment_Lock] [bit] NULL CONSTRAINT [DF_bankruptcy_Payment_Lock] DEFAULT (0),

    [outstanding_att_fees] [money] NULL,

    [att_file_num] [varchar](30) NULL,

    [do_not_refer] [bit] NOT NULL DEFAULT (0),

    [discharge_date] [datetime] NULL,

    [bankruptcy_actual_end_date] [datetime] NULL,

    [bankruptcy_module_close_date] [datetime] NULL,

    [plan_terms] [varchar](200) NULL,

    [Motion_for_Relief_Filed_Date] [DATETIME] NULL,

    [Motion_for_Relief_Stay_Lifted_Date] [DATETIME] NULL,

    [Plan_Confirmation_Date] [DATETIME] NULL,

    [Attorney_Referral_Date] [DATETIME] NULL,

    [Proof_of_Claim_Filing_Date] [DATETIME] NULL,

    [Payment_Plan_Start_Date] [DATETIME] NULL,

    [Payment_Plan_End_Date] [DATETIME] NULL

    CREATE TABLE [dbo].[bankruptcy_event](

    [bankruptcy_event_id] [int] NOT NULL CONSTRAINT [DF_bankruptcy_bankruptcy_2__12] DEFAULT (0),

    [bankruptcy_schedule_code] [varchar](4) NOT NULL,

    [bankruptcy_event_order_id] [int] NULL,

    [bankruptcy_event_desc] [varchar](50) NOT NULL CONSTRAINT [DF_bankruptcy_bankruptcy_1__12] DEFAULT (0),

    [bankruptcy_event_days] [int] NULL,

    [default_flag] [tinyint] NULL

  • brekher (2/19/2009)


    If anyone can be of any help I would greatly appreciate this as this was handed down to me tonight and needs to be completed asap.

    What have you tried so far? Where are you stuck?

    I'm not going to write the entire thing for you.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi,

    I had started with the first trigger and 1st field but in testing I am updating all rows and need help with the insert.

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER OFF

    GO

    CREATE TRIGGER [dbo].[tiu_bankruptcy_event_log] ON [dbo].[bankruptcy_event_log]

    AFTER INSERT,UPDATE

    AS

    IF EXISTS

    (

    SELECT

    bl.actual_end_date FROM bankruptcy_event_log bl

    JOIN bankruptcy_event be ON be.bankruptcy_event_id = bl.bankruptcy_event_id

    where be.bankruptcy_event_desc = 'MFR Filed'

    and bl.bankruptcy_event_status = 'C'

    )

    BEGIN

    UPDATE

    bankruptcy

    SET

    Motion_for_Relief_Filed_Date =

    (

    SELECT

    MAX(bl.[actual_end_date])

    FROM

    bankruptcy_event_log bl

    JOIN [bankruptcy] b ON bl.bankruptcy_id = b.bankruptcy_id

    WHERE bl.bayview_loan_number = b.bayview_loan_number

    )

    END

  • brekher (2/20/2009)


    Hi,

    I had started with the first trigger and 1st field but in testing I am updating all rows and need help with the insert.

    Because you're not looking at the inserted table. The inserted and deleted pseudo-tables have the rows that were affected by the trigger.

    Inserted contains the new rows for an insert trigger and the new values for an update trigger. The deleted table contains the deleted rows for a delete trigger and the old values for an update trigger.

    So, as a rough example, your update should have this form

    UPDATE SomeTable

    SET ....

    WHERE SomeTable.PrimaryKeyColumn IN (SELECT PrimaryKeyColumn FROM inserted)

    Make sense?

    As for your update, post what you've got so far and what you're having trouble with.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi,

    Thanks, it does make sense and I tried that approach but I am unable to get the value from this statement (especially the fact that I need the max(actual_end_date))

    SELECT

    bl.actual_end_date FROM bankruptcy_event_log bl

    JOIN bankruptcy_event be ON be.bankruptcy_event_id = bl.bankruptcy_event_id

    where be.bankruptcy_event_desc = 'MFR Filed'

    and bl.bankruptcy_event_status = 'C'

    to update only the Motion_for_Relief_Filed_Date, bayview_loan_number and bankruptcy_id in the Bankruptcy table. Those are the only 3 columns I need to insert if they are new or update if they have been changed in the bankruptcy_event_log table. Thanks again for your help!

  • Hmm. I think we're going to need more info.

    Please post sample data and desired output. Read this to see the best way to post this to get quick responses.

    http://qa.sqlservercentral.com/articles/Best+Practices/61537/

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • My script to extract data for the Bankruptcy table is chocking on a few fields but the other tables I was able to extract sample data. I hope its posted as you prefered and thank you again for all your help.

    INSERT bankruptcy_event_log(bayview_loan_number,bankruptcy_id,bankruptcy_event_log_id,bankruptcy_event_id,projected_end_date,actual_end_date,bankruptcy_event_status,bankruptcy_hold_start_date,bankruptcy_days_on_hold,reason_on_hold,bankruptcy_schedule_code,default_flag,delay_reason) VALUES ('100000',1,1,1,NULL,'Feb 10 2003 12:00AM','C',NULL,NULL,'','13CC',1,NULL)

    INSERT bankruptcy_event_log(bayview_loan_number,bankruptcy_id,bankruptcy_event_log_id,bankruptcy_event_id,projected_end_date,actual_end_date,bankruptcy_event_status,bankruptcy_hold_start_date,bankruptcy_days_on_hold,reason_on_hold,bankruptcy_schedule_code,default_flag,delay_reason) VALUES ('100000',1,2,2,NULL,'Feb 10 2003 12:00AM','C',NULL,NULL,'','13CC',1,NULL)

    INSERT bankruptcy_event_log(bayview_loan_number,bankruptcy_id,bankruptcy_event_log_id,bankruptcy_event_id,projected_end_date,actual_end_date,bankruptcy_event_status,bankruptcy_hold_start_date,bankruptcy_days_on_hold,reason_on_hold,bankruptcy_schedule_code,default_flag,delay_reason) VALUES ('100000',1,3,3,NULL,'Feb 10 2003 12:00AM','C',NULL,NULL,'','13CC',1,NULL)

    INSERT bankruptcy_event_log(bayview_loan_number,bankruptcy_id,bankruptcy_event_log_id,bankruptcy_event_id,projected_end_date,actual_end_date,bankruptcy_event_status,bankruptcy_hold_start_date,bankruptcy_days_on_hold,reason_on_hold,bankruptcy_schedule_code,default_flag,delay_reason) VALUES ('100000',1,4,4,NULL,'Feb 10 2003 12:00AM','C',NULL,NULL,'','13CC',1,NULL)

    INSERT bankruptcy_event_log(bayview_loan_number,bankruptcy_id,bankruptcy_event_log_id,bankruptcy_event_id,projected_end_date,actual_end_date,bankruptcy_event_status,bankruptcy_hold_start_date,bankruptcy_days_on_hold,reason_on_hold,bankruptcy_schedule_code,default_flag,delay_reason) VALUES ('100000',1,5,5,NULL,'Feb 10 2003 12:00AM','C',NULL,NULL,'','13CC',1,NULL)

    INSERT bankruptcy_event_log(bayview_loan_number,bankruptcy_id,bankruptcy_event_log_id,bankruptcy_event_id,projected_end_date,actual_end_date,bankruptcy_event_status,bankruptcy_hold_start_date,bankruptcy_days_on_hold,reason_on_hold,bankruptcy_schedule_code,default_flag,delay_reason) VALUES ('100000',1,6,6,NULL,'Feb 10 2003 12:00AM','C',NULL,NULL,'','13CC',1,NULL)

    INSERT bankruptcy_event_log(bayview_loan_number,bankruptcy_id,bankruptcy_event_log_id,bankruptcy_event_id,projected_end_date,actual_end_date,bankruptcy_event_status,bankruptcy_hold_start_date,bankruptcy_days_on_hold,reason_on_hold,bankruptcy_schedule_code,default_flag,delay_reason) VALUES ('100000',1,7,1,NULL,'Feb 10 2003 12:00AM','C',NULL,NULL,'','13PC',1,NULL)

    INSERT bankruptcy_event_log(bayview_loan_number,bankruptcy_id,bankruptcy_event_log_id,bankruptcy_event_id,projected_end_date,actual_end_date,bankruptcy_event_status,bankruptcy_hold_start_date,bankruptcy_days_on_hold,reason_on_hold,bankruptcy_schedule_code,default_flag,delay_reason) VALUES ('100000',1,8,2,NULL,'Feb 10 2003 12:00AM','C',NULL,NULL,'','13PC',1,NULL)

    INSERT bankruptcy_event_log(bayview_loan_number,bankruptcy_id,bankruptcy_event_log_id,bankruptcy_event_id,projected_end_date,actual_end_date,bankruptcy_event_status,bankruptcy_hold_start_date,bankruptcy_days_on_hold,reason_on_hold,bankruptcy_schedule_code,default_flag,delay_reason) VALUES ('100000',1,9,3,NULL,'Feb 10 2003 12:00AM','C',NULL,NULL,'','13PC',1,NULL)

    INSERT bankruptcy_event_log(bayview_loan_number,bankruptcy_id,bankruptcy_event_log_id,bankruptcy_event_id,projected_end_date,actual_end_date,bankruptcy_event_status,bankruptcy_hold_start_date,bankruptcy_days_on_hold,reason_on_hold,bankruptcy_schedule_code,default_flag,delay_reason) VALUES ('100000',1,10,4,NULL,'Feb 10 2003 12:00AM','C',NULL,NULL,'','13PC',1,2)

    INSERT bankruptcy_event(bankruptcy_event_id,bankruptcy_schedule_code,bankruptcy_event_order_id,bankruptcy_event_desc,bankruptcy_event_days,default_flag) VALUES (1,'13CC',10,'POC Requested',0,1)

    INSERT bankruptcy_event(bankruptcy_event_id,bankruptcy_schedule_code,bankruptcy_event_order_id,bankruptcy_event_desc,bankruptcy_event_days,default_flag) VALUES (2,'13CC',20,'POC Filed',7,1)

    INSERT bankruptcy_event(bankruptcy_event_id,bankruptcy_schedule_code,bankruptcy_event_order_id,bankruptcy_event_desc,bankruptcy_event_days,default_flag) VALUES (3,'13CC',30,'Objection to POC Received',20,1)

    INSERT bankruptcy_event(bankruptcy_event_id,bankruptcy_schedule_code,bankruptcy_event_order_id,bankruptcy_event_desc,bankruptcy_event_days,default_flag) VALUES (4,'13CC',40,'Transfer Letter Sent',7,1)

    INSERT bankruptcy_event(bankruptcy_event_id,bankruptcy_schedule_code,bankruptcy_event_order_id,bankruptcy_event_desc,bankruptcy_event_days,default_flag) VALUES (5,'13CC',50,'Transfer of Claim Referred',30,1)

    INSERT bankruptcy_event(bankruptcy_event_id,bankruptcy_schedule_code,bankruptcy_event_order_id,bankruptcy_event_desc,bankruptcy_event_days,default_flag) VALUES (6,'13CC',60,'Transfer Completed',30,1)

    INSERT bankruptcy_event(bankruptcy_event_id,bankruptcy_schedule_code,bankruptcy_event_order_id,bankruptcy_event_desc,bankruptcy_event_days,default_flag) VALUES (1,'13CD',10,'POC Requested',0,1)

    INSERT bankruptcy_event(bankruptcy_event_id,bankruptcy_schedule_code,bankruptcy_event_order_id,bankruptcy_event_desc,bankruptcy_event_days,default_flag) VALUES (2,'13CD',20,'POC Filed',7,1)

    INSERT bankruptcy_event(bankruptcy_event_id,bankruptcy_schedule_code,bankruptcy_event_order_id,bankruptcy_event_desc,bankruptcy_event_days,default_flag) VALUES (3,'13CD',30,'Objection to POC Received',20,1)

    INSERT bankruptcy_event(bankruptcy_event_id,bankruptcy_schedule_code,bankruptcy_event_order_id,bankruptcy_event_desc,bankruptcy_event_days,default_flag) VALUES (4,'13CD',40,'Transfer Letter Sent',7,1)

    INSERT bankruptcy_stip_amount(bayview_loan_number,bankruptcy_id,stip_id,Amount,DueDate,CheckNumber,ReceivedDate,DefaultDate,StipUnapplied,edit_date,edit_uid,CheckDate) VALUES ('105609',2,4,412.25,'May 20 2001 12:00AM','02966111223','May 30 2001 12:00AM',NULL,412.25,'Dec 16 2002 11:35AM','cadams','May 26 2001 12:00AM')

    INSERT bankruptcy_stip_amount(bayview_loan_number,bankruptcy_id,stip_id,Amount,DueDate,CheckNumber,ReceivedDate,DefaultDate,StipUnapplied,edit_date,edit_uid,CheckDate) VALUES ('105609',2,3,412.25,'Jun 20 2001 12:00AM','02966111706','Jul 10 2001 12:00AM',NULL,412.25,'Dec 16 2002 11:35AM','cadams','Jun 30 2001 12:00AM')

    INSERT bankruptcy_stip_amount(bayview_loan_number,bankruptcy_id,stip_id,Amount,DueDate,CheckNumber,ReceivedDate,DefaultDate,StipUnapplied,edit_date,edit_uid,CheckDate) VALUES ('105609',2,2,412.25,'Jul 20 2001 12:00AM','MO62059041','Aug 7 2001 12:00AM',NULL,412.25,'Dec 16 2002 11:35AM','cadams','Aug 4 2001 12:00AM')

    INSERT bankruptcy_stip_amount(bayview_loan_number,bankruptcy_id,stip_id,Amount,DueDate,CheckNumber,ReceivedDate,DefaultDate,StipUnapplied,edit_date,edit_uid,CheckDate) VALUES ('105609',2,1,412.25,'Aug 20 2001 12:00AM','mo62269971','Sep 7 2001 12:00AM',NULL,412.25,'Dec 16 2002 11:35AM','cadams','Sep 6 2001 12:00AM')

    INSERT bankruptcy_stip_amount(bayview_loan_number,bankruptcy_id,stip_id,Amount,DueDate,CheckNumber,ReceivedDate,DefaultDate,StipUnapplied,edit_date,edit_uid,CheckDate) VALUES ('143824102',1,4,893.50,'Aug 1 2001 12:00AM','',NULL,NULL,0.00,'Aug 29 2001 5:11PM','ylopez',NULL)

    INSERT bankruptcy_stip_amount(bayview_loan_number,bankruptcy_id,stip_id,Amount,DueDate,CheckNumber,ReceivedDate,DefaultDate,StipUnapplied,edit_date,edit_uid,CheckDate) VALUES ('123738',1,6,894.67,'May 4 2001 12:00AM','609','Apr 26 2001 12:00AM','Dec 1 2000 12:00AM',-5266.76,'May 14 2001 11:09AM','jsobrino','Nov 30 2000 12:00AM')

    INSERT bankruptcy_stip_amount(bayview_loan_number,bankruptcy_id,stip_id,Amount,DueDate,CheckNumber,ReceivedDate,DefaultDate,StipUnapplied,edit_date,edit_uid,CheckDate) VALUES ('123738',1,5,2500.00,'May 31 2001 12:00AM','',NULL,NULL,0.00,'May 14 2001 11:09AM','jsobrino',NULL)

    INSERT bankruptcy_stip_amount(bayview_loan_number,bankruptcy_id,stip_id,Amount,DueDate,CheckNumber,ReceivedDate,DefaultDate,StipUnapplied,edit_date,edit_uid,CheckDate) VALUES ('123738',1,4,691.69,'Jul 1 2001 12:00AM','',NULL,NULL,0.00,'May 14 2001 11:09AM','jsobrino',NULL)

    INSERT bankruptcy_stip_amount(bayview_loan_number,bankruptcy_id,stip_id,Amount,DueDate,CheckNumber,ReceivedDate,DefaultDate,StipUnapplied,edit_date,edit_uid,CheckDate) VALUES ('123738',1,3,691.69,'Aug 1 2001 12:00AM','',NULL,NULL,0.00,'May 14 2001 11:09AM','jsobrino',NULL)

    INSERT bankruptcy_stip_amount(bayview_loan_number,bankruptcy_id,stip_id,Amount,DueDate,CheckNumber,ReceivedDate,DefaultDate,StipUnapplied,edit_date,edit_uid,CheckDate) VALUES ('123738',1,2,691.69,'Sep 1 2001 12:00AM','',NULL,NULL,0.00,'May 14 2001 11:09AM','jsobrino',NULL)

  • brekher (2/20/2009)


    My script to extract data for the Bankruptcy table is chocking on a few fields but the other tables I was able to extract sample data. I hope its posted as you prefered and thank you again for all your help.

    Almost.

    Please give me an insert or update for the bankruptcy_event_log table and show what the bankruptcy table should look like after.

    Cut down the bankruptcy table to just the important columns. Since that's the target of the update, I kinda do need data for that to figure this out.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • This insert into event_log should insert into Bankruptcy the bayview_loan_number, bankruptcy_id and the max(actual_end_date)

    as the new field I created Motion_for_Relief_Filed_Date. If the bayview_loan_number, bankruptcy_id already exist in bankurptcy then based on those 2 fields the Motion_for_Relief_Filed_Date should be populated. Only those 3 columns will ever be effected. I posed the entire insert in Bankruptcy with the defaults just in case and for chapter it takes 'NULL' but if not it there will be different logic by the developers to insert a 7,13,11,or 12 but that should not matter to me in this process. Thanks!

    INSERT bankruptcy_event_log

    (

    bayview_loan_number,

    bankruptcy_id,

    bankruptcy_event_log_id,

    bankruptcy_event_id,

    projected_end_date,

    actual_end_date,

    bankruptcy_event_status,

    bankruptcy_hold_start_date,

    bankruptcy_days_on_hold,

    reason_on_hold,

    bankruptcy_schedule_code,

    default_flag,

    delay_reason)

    VALUES (

    '100000',

    1,

    1,

    1,

    NULL,

    'Feb 10 2003 12:00AM',

    'C',

    NULL,

    NULL,

    '',

    '13CC',

    1,

    NULL)

    Insert into Bankruptcy

    INSERT INTO

    [bankruptcy] (

    [bayview_loan_number],

    [loan_id],

    [bankruptcy_id],

    [debtor_code],

    [bankruptcy_chapter],

    [bk_coordinator_uid_curr],

    [bk_coordinator_uid_orig],

    [bankruptcy_file_date],

    [case_number],

    [trustee_id],

    [debtor_attorney_id],

    [interbay_attorney_id],

    [judge_id],

    [district_id],

    [first_post_petition_date],

    [next_post_petition_date],

    [payor_code],

    [bankruptcy_status],

    [poc_amount],

    [poc_date],

    [bankruptcy_end_date],

    [bankruptcy_end_type],

    [notification_date],

    [consent_due_date],

    [trustee_next_due_date],

    [bankruptcy_schedule_code],

    [edit_uid],

    [edit_date],

    [interbay_bk_start_date],

    [bk_coordinator_uid_prev],

    [bankruptcy_proj_end_date],

    [consent_comment],

    [proj_end_hold_date],

    [debtor_name_last],

    [debtor_name_first],

    [upb_at_filling],

    [borrower_id],

    [stipulation_amount],

    [unapplied_balance],

    [stipulation_start_date],

    [real_postp_date],

    [legal_status_prev],

    [warning],

    [warning_date],

    [Payment_Lock],

    [outstanding_att_fees],

    [att_file_num],

    [do_not_refer],

    [discharge_date],

    [bankruptcy_actual_end_date],

    [bankruptcy_module_close_date],

    [plan_terms]

    ) VALUES (

    /* bayview_loan_number - varchar(10) */ '',

    /* loan_id - varchar(10) */ '',

    /* bankruptcy_id - int */ 0,

    /* debtor_code - varchar(4) */ '',

    /* bankruptcy_chapter - varchar(2) */ '',

    /* bk_coordinator_uid_curr - varchar(20) */ '',

    /* bk_coordinator_uid_orig - varchar(20) */ '',

    /* bankruptcy_file_date - datetime */ '2009-2-20 14:53:36.337',

    /* case_number - varchar(20) */ '',

    /* trustee_id - int */ 0,

    /* debtor_attorney_id - int */ 0,

    /* interbay_attorney_id - int */ 0,

    /* judge_id - int */ 0,

    /* district_id - int */ 0,

    /* first_post_petition_date - datetime */ '2009-2-20 14:53:36.337',

    /* next_post_petition_date - datetime */ '2009-2-20 14:53:36.352',

    /* payor_code - varchar(1) */ '',

    /* bankruptcy_status - varchar(1) */ '',

    /* poc_amount - money */ 0,

    /* poc_date - datetime */ '2009-2-20 14:53:36.352',

    /* bankruptcy_end_date - datetime */ '2009-2-20 14:53:36.352',

    /* bankruptcy_end_type - int */ 0,

    /* notification_date - datetime */ '2009-2-20 14:53:36.352',

    /* consent_due_date - datetime */ '2009-2-20 14:53:36.352',

    /* trustee_next_due_date - datetime */ '2009-2-20 14:53:36.352',

    /* bankruptcy_schedule_code - varchar(4) */ '',

    /* edit_uid - varchar(20) */ '',

    /* edit_date - datetime */ '2009-2-20 14:53:36.352',

    /* interbay_bk_start_date - datetime */ '2009-2-20 14:53:36.352',

    /* bk_coordinator_uid_prev - varchar(10) */ '',

    /* bankruptcy_proj_end_date - datetime */ '2009-2-20 14:53:36.352',

    /* consent_comment - text */ '',

    /* proj_end_hold_date - datetime */ '2009-2-20 14:53:36.352',

    /* debtor_name_last - varchar(40) */ '',

    /* debtor_name_first - varchar(30) */ '',

    /* upb_at_filling - money */ 0,

    /* borrower_id - int */ 0,

    /* stipulation_amount - money */ 0,

    /* unapplied_balance - money */ 0,

    /* stipulation_start_date - datetime */ '2009-2-20 14:53:36.352',

    /* real_postp_date - bit */ 0,

    /* legal_status_prev - varchar(8) */ '',

    /* warning - numeric(18, 0) */ 0,

    /* warning_date - datetime */ '2009-2-20 14:53:36.352',

    /* Payment_Lock - bit */ 0,

    /* outstanding_att_fees - money */ 0,

    /* att_file_num - varchar(30) */ '',

    /* do_not_refer - bit */ 0,

    /* discharge_date - datetime */ '2009-2-20 14:53:36.352',

    /* bankruptcy_actual_end_date - datetime */ '2009-2-20 14:53:36.352',

    /* bankruptcy_module_close_date - datetime */ '2009-2-20 14:53:36.352',

    /* plan_terms - varchar(200) */ '' )

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply