Select/Insert multiple records from numerous tables

Select/Insert multiple records from numerous tables

Post by Jon Finle » Wed, 21 Feb 2001 03:59:10



Hi,

I have a situation where I need to copy a "policy", allow an operator to work on
the copy, and eventually throw the copy away or update the original policy with
the data from the copy.  This gets a little complicated as the "policy" consists
of multiple records in 6 tables. Some of the tables contain multiple records
(like an line item table connected to an order table). Obviously the new records
would have to be connected via the correct primary key (from the just
copied/inserted records).

I can imagine how to do this manually in an sp but it involves a lot of logic.  
Does anyone know of an easier way to accomplish this??  All tables use RI and
connected via constraints.

Thanks!

Jon Finley
Minneapoli

 
 
 

1. Using a trigger to select then insert multiple records

Hi

I'm trying to write a trigger in SQL Server 2000 that will fire after
I insert a new set of priviliges to a table of priviliges and insert a
record in a table of groups for each user that can have this
privilage. I can get it to work should there only be one user in the
group but I can't figure out how to select multiple records and then
loop through them inserting a new record for each one.

This is what i was trying to do:

CREATE TRIGGER add_privs ON [dbo].[tblPrivs] AFTER INSERT
AS










INSERT INTO tblUserGroups (userGroupGroup, userGroupUser,


insert 5 times creating a new record for each userID.

I'm possibly fast climbing the wrong tree but if someone could point
me towarsd the right one I'd be grateful :)

TIA

Rachel

2. D3/Linux install question

3. loop thru table multiple selects/inserts

4. Licensing

5. Insert,Update&Delete Record in Multiple Table

6. SQL Programer VS SQL Navigator

7. SELECTING records from multiple Tables

8. Program Global Area

9. Insert multiple records to child table from ASP page

10. Insert,Update,Delete Record in Multiple Table-URGENT

11. Insert,Update,Delete Record from Multiple Table

12. Insert Multiple .txt files to one table, 1file per record

13. Insert,Update,Delete Record in Multiple Table-URGENT