does @@identity return the primary key or identity field?

Posted by elspiko on Stack Overflow See other posts from Stack Overflow or by elspiko
Published on 2010-05-12T14:19:12Z Indexed on 2010/05/12 14:24 UTC
Read the original article Hit count: 114

Filed under:
|
|

Hi,

My issue is that I've got update triggers on an SQL View (MS SQL 2005) which I'm mapping to LINQ to SQL entities in C#...

My SQL looks correct but it complains about trying to insert a null value into a secondary table PK field.

I believe my issue relates to having the primary key and identity as seperate fields in the primary table. So my question is this....when using @@identity, does it look at the primary key of the inserted row, or does it look at the field with "IDENTITY" specified???

© Stack Overflow or respective owner

Related posts about sql

Related posts about c#