Insert into more than one table

I have this select command

SELECT intUserId FROM tblUser

I want to insert every intUserId into tblUserBla,tblUserBla2

I know that i can do this

INSERT INTO tblUserBla (intUserId) SELECT intUserId FROM TblUser

But, how can i perform a insert into tow tables, in one statement



Answer this question

Insert into more than one table

  • Jenkins

    But how can my trigger get my intUserId
  • areisinger

    this will be the body of the after insert trigger on the first table
    insert into [2nd table] select intUserId from inserted
    which will insert only the newly inserted IDs


  • ISH_STEPHAN

    Thank you very much
  • Thad

    you can add a trigger in the first table that inserts the required values into the 2nd table after the insertion



  • Insert into more than one table