title: Get inserted table identity value and update another table
body: <p>I have two tables with foreign key constraint on TableB on TablesAs KeyA column. I was doing manual inserts till now as they were only few rows to be added. Now i need to do a bulk insert, so my question if i insert multiple rows in TableA how can i get all those identity values and insert them into TableB along with other column values. Please see the script below.</p>
  
  <pre><code>INSERT INTO Tablea
         ([KeyA]
         ,[Value] )
      SELECT 4 ,'StateA'
  UNION ALL
  SELECT 5 ,'StateB'
  UNION ALL
  SELECT 6 ,'StateC'
  
  INSERT INTO Tableb
         ([KeyB]
         ,[fKeyA] //Get value from the inserted row from TableA
         ,[Desc])
  SELECT 1 ,4,'Value1'
  UNION ALL
  SELECT 2 ,5,'Value2'
  UNION ALL
  SELECT 3 ,6, 'Value3'
  </code></pre>