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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2007-01-29 : 10:16:43
|
| Steve writes "I have a process that inserts multiple rows into a table at one time (INSERT INTO .... (SELECT * FROM ....))I have created an associated stored procedure on a secondary table that accepts 1 param (a PK) and updates a specific field in the row. As the rows are inserted into table1, I have a TRIGGER that fires on INSERT. Since multiple rows are inserted at once, I need the Trigger to SELECT the PK from the INSERTED table, and execute the Stored Procedure passing the PK as the input param. The question is, how do I iterate thru the INSERTED table, once per row inserted, extract each PK and execute the stored proc????Thanks,Steve" |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-01-29 : 10:27:55
|
that can be acomplished with a cursor.your better bet would probably be to write a sproc thhat reads data from the #temp table.you fill that #temp table with data frmo inserted pseudo-table.Go with the flow & have fun! Else fight the flow blog thingie: http://weblogs.sqlteam.com/mladenp |
 |
|
|
|
|
|