SQL query

Saturday, 30 November 2013

Get the last inserted row ID

Method 1 

INSERT INTO dbo.YourTableName (Columns.......) VALUES (...........)
SELECT SCOPE_IDENTITY() 

Method 2 

DECLARE @id int 
INSERT INTO dbo.YourTableName (Columns.......) VALUES (...........)
SET @id=@@identity
SELECT @id 
 
  
Posted by C# Sample Coding at 03:33 No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Blog Archive

  • ►  2016 (3)
    • ►  September (1)
    • ►  July (2)
  • ►  2015 (3)
    • ►  August (1)
    • ►  May (1)
    • ►  April (1)
  • ►  2014 (11)
    • ►  November (1)
    • ►  August (1)
    • ►  May (1)
    • ►  April (5)
    • ►  March (2)
    • ►  January (1)
  • ▼  2013 (17)
    • ▼  November (1)
      • Get the last inserted row ID
    • ►  October (1)
    • ►  August (2)
    • ►  May (13)

About Me

My photo
C# Sample Coding
PHP
ASP.net
SQL query2008
SYSTEM BASIC
கை வைத்தியம்
சுவையான உணவு
http://kalaiy.blogspot.in
View my complete profile
Ethereal theme. Powered by Blogger.