SQL 2000 Trigger Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • majastic
    New Member
    • Aug 2007
    • 1

    SQL 2000 Trigger Question

    Hello all,

    I have a database question for you. I have a table in SQL 2000 that I think I need a trigger for. I'm tring to get the trigger to take the last two numbers from one field and replace the number in another field on the same table, see my example that follows:


    Before Trigger

    Table: Job
    J_User1: 0122567801
    J_JobType: 20

    I would like to take the last two numbers fromt he J_User1 field on the Job table and replace the numbers on the J_JobType



    After Trigger

    Table: Job
    J_User1: 0122567801
    J_JobType: 01

    Any help would be great.

    Andy
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by majastic
    Hello all,

    I have a database question for you. I have a table in SQL 2000 that I think I need a trigger for. I'm tring to get the trigger to take the last two numbers from one field and replace the number in another field on the same table, see my example that follows:


    Before Trigger

    Table: Job
    J_User1: 0122567801
    J_JobType: 20

    I would like to take the last two numbers fromt he J_User1 field on the Job table and replace the numbers on the J_JobType



    After Trigger

    Table: Job
    J_User1: 0122567801
    J_JobType: 01

    Any help would be great.

    Andy

    can't it be handled by DEFAULT? or you may define J_JobType as calculated field and store the last two digit of the J-JUser1.

    of course, trigger may still handle this. grab all values from the inserted table, force an insert with J_JobType field will contain the desired expression..che ck for error, otherwise, commit

    Comment

    Working...