Introducing DotNetFunda.com on mobile http://m.dotnetfunda.com ! Be with DotNetFunda.com on the go !
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 10167 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > SQL Server Interview Questions > How you can get the last identity value ...

How you can get the last identity value inserted in any table ?

Interview question and answer by: Neeks | Posted on: 3/5/2009 | Category: SQL Server Interview questions | Views: 3789 |


Answer:

SQL Server 2000 has a System Variable @@IDENTITY which gives the last identity element value inserted in any table

Asked In: Many Interviews | Alert Moderator 
Found interesting? Add this to:


 Responses

Posted by: Vuyiswamb | Posted on: 31 Mar 2009 11:19:38 PM | Alert Moderator 

The @@IDENTITY will not always bring you the last inserted identity Column. The one way that will surely bring you the last identity value is like this

select IDENT_CURRENT ('mytable')


>> Write Response - Respond to this post and get points

Even more ... | Submit Interview Questions and win prizes!

More Interview Questions from Neeks

Even more ... | Submit Interview Questions and win prizes!


About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you found plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2012 9:03:14 AM