title: Conflicting Foreign Key SSMS
body: <p>I am trying to insert my CSV into my tables. I have a table called Income that looks like this:</p>
  
  <pre><code>Create table Income
  (
      incomeID INT PRIMARY KEY IDENTITY,
      income_bracket varchar(100) NOT NULL,
  
  );
  </code></pre>
  
  <p>There are only 2 rows in this table. Its <code>&lt;=50K</code> and <code>&gt;50K</code>. Therefore there are only 2 Ids. My CSV file also shows that there are only 2 rows. This is my foreign key constraint:</p>
  
  <pre><code>AlTER TABLE IncomeFacts ADD CONSTRAINT 
  FK_incomeID FOREIGN KEY (incomeID)REFERENCES Income(incomeID);
  
  </code></pre>
  
  <p><em>NOTE</em> - <code>IncomeFacts</code> is my facts table</p>
  
  <p>When inserting in SQL I have the following:</p>
  
  <pre><code>
  BULK INSERT  [US_AdultIncome].[dbo].[Income] FROM '$(SqlPathAdultIncome)IncomeTable.csv'
  WITH (
      CHECK_CONSTRAINTS,
      --CODEPAGE='ACP',
      FIRSTROW = 2,
      DATAFILETYPE='char',
      FIELDTERMINATOR=',',
      ROWTERMINATOR='\n',
      --KEEPIDENTITY,
      TABLOCK
  );
  </code></pre>
  
  <p>The first row is a header so I skip that.</p>
  
  <p>However I get this error:</p>
  
  <pre><code>Msg 547, Level 16, State 0, Line 125
  The INSERT statement conflicted with the FOREIGN KEY constraint "FK_incomeID". The conflict occurred in database "US_AdultIncome", table "dbo.Income", column 'incomeID'.
  </code></pre>
  
  <p>I know what the error means but I can see anywhere why this isnt working.</p>