select @@identity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cmrhema
    Contributor
    • Jan 2007
    • 375

    select @@identity

    Hi,

    I have a table emp1 where i have two fields empno and empname. I have not assigned primary keys to any of these. After inserting values when I put on
    select @@identity or
    select @@identity from emp1

    I always get the answer as NULL. Whereas it should return the maximum number of rows.

    What could be the problem.
    Kindly let me know.


    Regards
    cmrhema
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    You're looking for COUNT(*) not @@identity.

    -- CK

    Comment

    • cmrhema
      Contributor
      • Jan 2007
      • 375

      #3
      Thanks for the reply, after reading carefully I found that we should have a field that has an autonumber set to it.

      I did not do that

      Thanks for the reply

      regards
      cmrhema

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        Then, that's IDENTITY.

        -- CK

        Comment

        Working...