lejo

lejo

  • 1.3k
  • 345
  • 9.6k

Insert from temparay table

Nov 20 2022 1:01 PM

i have 3 rows in my temparay table .i want to insert one by one in master and child table .with primary key of master table in to child table.

when i inserting first row master key id is repeating all columnins in second table.

temp table structure

EmpName    ChildName

  Employee1   Student1

  Employee1    Student2

  Employee2    Student3

  Employee3    Student4

i have to get result like below in tables

eg: Empid  employeeName

      1            Employee1   

      2            Employee2    

      3            Employee3    

child table

 

    ChildID   EmpID      ChildName

     1            1               Student1

     2             1              Student2

     3             2             Student3

     4             3             Student4

    


Answers (2)