Does @@ return the identifier of the primary key or identification field?

My problem is that I have update triggers in SQL View (MS SQL 2005) that I map to LINQ to SQL objects in C # ...

My SQL looks correct, but it complains about trying to insert a null value in the PK field of the secondary table.

I believe that my problem is that the primary key and identification are separate fields in the primary table. So my question is that ... when using @@ identity, does it look at the primary key of the inserted row or look in the field with the specified "IDENTITY" ???

+3
source share
3 answers

@@IDENTITY . , . @@IDENTITY SCOPE_IDENTITY(), . @@IDENTITY ( ), IDENTITY. , , PK .

. SCOPE_IDENTITY.

+12

SELECT SCOPE_IDENTITY() @@Identity

+2

@@IDENTITY , . ( , ?) , , , SCOPE_IDENTITY().

0
source

Source: https://habr.com/ru/post/1745119/


All Articles