We are using a CRM system and I have had trouble creating a trigger that would automatically update another field on a record. The first table I am working with is Sales that has a key3 field. Within this field we insert Sales Rep names from a user table. Within this users table we have another column with the users ID. So what I would like to do is create a trigger that would recognize when a Sales Rep name is added to this key3 field and then autoupdate another field with the associated USERID. Thank you for the help.
I'm going to recommend NOT using a trigger to do this.
I'm also going to recommend NOT using a stored procedure to do this.
In fact, I'm going to recommend NOT doing this at all.
It's a form of denormalization AND unnecessary duplication of data. Further, if there's ever a name change for the given ID, you'll need a separate one-off process to change it. Even if that never happens, it's still an unnecessary duplication of data and should be avoided because of all of the rules of normalization.
is pronounced ree-bar and is a Modenism for R
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair
How to post code problemsHow to post performance problemsForum FAQs