TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
SQL Server Identity Column
Ravi Patel
Dec 30
2015
Code
1.1
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
select
@@IDENTITY
-- returns the last IDENTITY value produced on a connection
select
IDENT_CURRENT(
'tableName'
)
-- returns the last IDENTITY value produced in a Table
select
Scope_IDENTITY()
-- returns the last IDENTITY value produced on a connection
Example
insert
into
Emp
values
(
'patel'
,700)
select
@@IDENTITY
-- or ---
select
scope_identity()
-- or --
select
IDENT_CURRENT(
'Emp'
)
sql server
SQL Server Identity Column
etrieving the current inserted identity id from table