title: Using @@identity or output when inserting into SQL Server view?
body: <p>(forgive me - I'm new to both StackOverflow &amp; SQL)
  Tl;dr - When using <code>@@identity</code> (or any other option such as scope_identity or output variable), is it possible to also use a view? Here is an example of a stored procedure using <code>@@identity</code>:</p>
  
  <pre><code>--SNIP--
  DECLARE @AID INT
  DECLARE @BID INT
  
  
  INSERT INTO dbo.A (oct1)
  VALUES
  (@oct1)
  
  SELECT @AID = @@IDENTITY;
  
  INSERT INTO dbo.B (duo1)
  VALUES
  (@duo2)
  
  SELECT @BID = @@IDENTITY
  
  INSERT INTO dbo.tblAB (AID, BID)
  VALUES
  (@AID, @BID)
  GO
  </code></pre>
  
  <p>Longer:</p>
  
  <p>When inserting into a table, you can capture the current value of the identity seed using <code>@@identity</code>. This is useful if you want to insert into table A and B, capture the identity value, then insert into table AB relating A to B. Obviously this is for purposes of data normalization.</p>
  
  <p>Let's say you were to abstract the DB Schema with a few that performs inner joins on your tables to make the data easier to work with. How would you populate the cross reference tables properly in that case? Can it be done the same way, if so, how?</p>