Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ConfusedAgain
Yak Posting Veteran
82 Posts |
Posted - 2011-05-23 : 12:05:08
|
| Is this possible?I have a table that gets updated with a RefID of a record in another table. I want to be able to after Insert, on a trigger, get the RefId from the table that has had the insert and use that RefID to select and insert another record based on some of the data on that record in the original table.ie:Table1 RefID Group OriginalGroup1 A NULL2 A NULL3 B NULL Table 2 gets an insert of RefID = 1, Table2 RefID Status1 GroupBI then want to link to RefID 1 in Table 1 and create a new record in table 1 that would read RefID = 4 (assuming auto incremental ID) and Group = B and OriginalGroup = A |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-05-23 : 12:10:06
|
| create trigger trxxx on T2 after insertasinsert T2select ...from inserted ijoin T1 t1on i.refid = t1.refid==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|