By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,870 Members | 1,224 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,870 IT Pros & Developers. It's quick & easy.

SQL 2000 Trigger Question

P: 1
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
Aug 30 '07 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
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..check for error, otherwise, commit
Aug 30 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.