Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. what is @identity in sql server 2005

what is @identity in sql server 2005

Scheduled Pinned Locked Moved Database
databasesql-serversysadminquestion
4 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Roney
    wrote on last edited by
    #1

    what is @identity in sql server 2005............is a table or variable what functionality it has...plz explain.

    A F 2 Replies Last reply
    0
    • R Roney

      what is @identity in sql server 2005............is a table or variable what functionality it has...plz explain.

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      @identity is not part of SQL Server, so either its a variable you have declared or you meant @@identity which contains the last value inserted into an identity column.

      Bob Ashfield Consultants Ltd

      1 Reply Last reply
      0
      • R Roney

        what is @identity in sql server 2005............is a table or variable what functionality it has...plz explain.

        F Offline
        F Offline
        Frank Kerrigan
        wrote on last edited by
        #3

        I think you mean @@identity example INSERT INTO Production.Location (Name, CostRate, Availability, ModifiedDate) VALUES ('Damaged Goods', 5, 2.5, GETDATE()); GO SELECT @@IDENTITY AS 'Identity'; This gets the last Identity field inserted into a talbe, ie usually the primary key.

        DEVELOPER DAY SCOTLAND 2009 Watch this space http://www.developerdayscotland.com/[^]

        R 1 Reply Last reply
        0
        • F Frank Kerrigan

          I think you mean @@identity example INSERT INTO Production.Location (Name, CostRate, Availability, ModifiedDate) VALUES ('Damaged Goods', 5, 2.5, GETDATE()); GO SELECT @@IDENTITY AS 'Identity'; This gets the last Identity field inserted into a talbe, ie usually the primary key.

          DEVELOPER DAY SCOTLAND 2009 Watch this space http://www.developerdayscotland.com/[^]

          R Offline
          R Offline
          Roney
          wrote on last edited by
          #4

          yes sure....that one only and thank you for reply. so when we use @@identity it will get last identity field right.........it means one field value or total column......I think it returns only single value. one more...select Rank(1) from table update set=some column. it will get affect first row of the table ok. when i want 4th row should be execute is possible to give rank(4) .

          modified on Friday, October 10, 2008 2:54 AM

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups