| Author |
Topic |
|
gjohll
Starting Member
3 Posts |
Posted - 2010-09-24 : 14:56:02
|
| This is going to sound odd and I don't want to take the space to explain why, but this is what I need.Upon inserting a new row in a table, I need to have the value in one column copied into another column in the same table.I'm assuming this would be done via a trigger.CREATE TRIGGER trg_name ON tblNameAFTER INSERTAS???How do I get the value in column1 of the newly inserted row and copy it into column2? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
gjohll
Starting Member
3 Posts |
Posted - 2010-09-24 : 15:08:09
|
| The problem is I do not have access to the INSERT statement. The piece of software I'm using is abstracting some of the process from my direct control so I can't modify the Insert statement. The computed column might be the answer though... I'll look into that.Thanks! |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
gjohll
Starting Member
3 Posts |
Posted - 2010-09-24 : 22:55:56
|
| Adding a computed column works.This is using a DNN module DotNetMushroom. I can create/alter the tables through their module's GUI, but in the background they add some proprietary fields and take care of the inserts etc. Sometimes one is able to access their fields, sometimes not. So, when I ran into an instance of not being able to use one of their fields for filtering records being displayed, I figured at first using a trigger to copy their field into one that I could create (through the GUI). The computed column worked instead. THANKS!This isn't the way I'd do things if I had more of a say, but given what I've been dealt it's a work around to move the project further.Thanks again. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|