title: How to do an INSERT into tables with circular relationships (SQL SERVER)
body: <p>I'm dealing with a set of tables in a database that appear to have a circular relationship (see image). This is the ARTS database if that is of any help to anyone.</p>
  
  <p><img src="https://i.stack.imgur.com/uveUV.jpg" alt="Circular reference in Sql server"></p>
  
  <p><strong>A user signing on:</strong></p>
  
  <ul>
  <li>a) must create a (insert into) session, which in turn needs a SessionStartTransactionID (=SignOnTransaction) </li>
  <li>b) a SignOnTransaction is a type of ControlTransaction </li>
  <li>c) a ControlTransaciton is a type of Transaction </li>
  <li>d) a Transaction needs a reference to an existing Session (along with Operator, etc.)</li>
  </ul>
  
  <p><strong>Note:
  The Transaction.SessionStartTransactionID,Transaction.OperatorID, and Transaction.WorkStationID (thoese 3 are the composite primary key in Session) cannot be NULL in the Transaction table.</strong></p>
  
  <p>I can't figure out how to create (insert into) SignOnTransaction, or insert into any of the tables mentioned above. </p>
  
  <p><strong>How do you do that in SQL Server?</strong> Is that even possible? 
  Where would I start? 
  Thanks!</p>