Buy Questpond's video subscriptions on
huge discount
.
Online: 695
Home
Articles
Interviews
Forums
For Beginners
Popular Questions
ITIL Career Advice
PMP Career Advice
Career Advices
Codes
Videos
ASP.NET
ASP.NET MVC
Android Intel XDK
Sql Server
AngularJS
Bootstrap
Backbone.JS
MongoDB
LESS (CSS)
jQuery
WPF
WWF
SSIS
LightSwitch
Tutorials
News
ASP.NET MVC
|
Be Interview Ready
|
Top Performers
|
DNF MVP
|
Top Posts
|
Winners
|
Subscribe
|
Catalogs
Welcome Guest !
Register
Login
Home
>
Codes
>
Loading ...
How to get the last inserted record id from SQL Server
Posted by
Akiii
under
Sql Server
category on
7/10/2012
|
Points: 40
| Views : 14653
Post Code
|
Search Codes
|
Code Home
To get the last inserted record in a table :-
SELECT @@IDENTITY
SELECT IDENT_CURRENT('TableName')
Try running the above statements against any table, you will get the id of the last record inserted.
Thanks and Regards
Akiii
Alert Moderator
Bookmark It
Comments or Responses
Posted by:
Stewsterl
on: 2/25/2013 Level:
Starter
| Status:
[Member]
|
Points: 10
You can also get the ID of a record your inserting.
@iMySearchID int OUTPUT
SELECT @iMySearchID=SCOPE_IDENTITY()
Login to post response
Latest Code Snipptes
Azure Function - Connect to MS Dynamics using application user - .NET core 3.1
MS Dynamics 365- Custom action - Read input parameter values from plugin
MS Dynamics 365- Disassociate record from N-N relationship entity
Search box with icon in Navbar in bootstrap 4
Remove HTML tags using Regular Expression in C#
MS Dynamics 365- Close Quote from C# / Custom action
How to show and hide submenu in tabs using jquery
How to add star rating and submit rating
MS Dynamics 365 - Create an email activity using dynamics crm Rest API - C#
More ...