The IDENTITY property makes generating unique values easy. IDENTITY isn't a datatype. It's a column property.

Ex: CREATE TABLE Customer(cust_id smallint IDENTITY NOT NULL, cust_name VARCHAR(50) NOT NULL)

The system function @@IDENTITY contains the last identity value used by the connection.

SELECT @@IDENTITY:- If a trigger was fired for the INSERT, the value of @@IDENTITY might have changed.

SELECT SCOPE_IDENTITY:- If an INSERT trigger also inserted a row that contained an identity column, it would be in a different scope.

SELECT IDENT_CURRENT('Customer'): - To know the last IDENTITY value inserted in a specific TABLE from any application or user.

Mr. Mansoor Ali Mohammed - Software Engineer
I love to write articles. Programming languages fascinate me and I feel at least reasonably familiar with Sql Server database and .Net Technologies. The idea of articles come from my own experiences while working in those areas and i like to share my knowledge on database with all others so that it might be helpful.
Read moreRead more about Contributor