SQL, ostatni identity, @@IDENTITY , SCOPE_IDENTITY, IDENT_CURRENT

@@IDENTITY

np. select @@IDENTITY -- Returns 20

SCOPE_IDENTITY

INSERT table1 VALUES ('bork')

select @@IDENTITY [@@Identity], -- Returns 1
SCOPE_IDENTITY() [SCOPE_IDENTITY] -- Returns 1
FROM table1

IDENT_CURRENT

select IDENT_CURRENT(„nazwa_tabeli”)

Reklamy