title: SQL Server Error: Msg 515, Level 16, State 2 - inserting value to ID column? (NOT NULL field turned off)
body: <p>I created some tables, this is one of them: </p>
  
  <pre><code>CREATE TABLE JewelryOrders
  (
      OrderID INT, 
      JewelID INT,
      Quantity INT NOT NULL,
      PRIMARY KEY (OrderID, JewelID),
      FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
      FOREIGN KEY (JewelID) REFERENCES Jewels(JewelID)
  )
  </code></pre>
  
  <p>and then I tried to insert some data:</p>
  
  <pre><code>INSERT INTO JewelryOrders(Quantity)
  VALUES ('1'), ('2');
  </code></pre>
  
  <p>However, I got an error message:</p>
  
  <blockquote>
    <p>Msg 515, Level 16, State 2, Line 101<br>
    Cannot insert the value NULL into column 'OrderID', table 'JewelryStore.dbo.JewelryOrders'; column does not allow nulls. INSERT fails.</p>
  </blockquote>
  
  <p>The <code>OrderID</code> is defined this way in its original table:</p>
  
  <pre><code>CREATE TABLE Orders
  (
      OrderID INT IDENTITY PRIMARY KEY,
      CustomerID INT FOREIGN KEY REFERENCES Customers(CustomerID),
      OrderDate DATE NOT NULL,
      SumTotal INT NOT NULL,
  )
  </code></pre>
  
  <p>So it is not <code>NOT NULL</code> column. Any suggestions?</p>