Results 1 to 2 of 2

Thread: @@Identity

  1. #1
    Join Date
    Oct 2003
    Posts
    311

    Unanswered: @@Identity

    Does this only work with an identity column?


    my :

    INSERT INTO [Contacts].[ekr].[Usrs]([id], [Uid], [Pw], [writ], [Maint])
    VALUES(7, 'MM', 'WW', 1, 0)

    IF @@ERROR > 0
    RAISERROR('String, Severity level, State',16,122)
    ELSE
    SELECT @@Identity as NewOne


    Returns : NewOne
    NULL

  2. #2
    Join Date
    Dec 2002
    Posts
    1,245
    Yes. See the BOL entry on @@Identity.

    Regards,

    hmscott

    Quote Originally Posted by mikezcg
    Does this only work with an identity column?


    my :

    INSERT INTO [Contacts].[ekr].[Usrs]([id], [Uid], [Pw], [writ], [Maint])
    VALUES(7, 'MM', 'WW', 1, 0)

    IF @@ERROR > 0
    RAISERROR('String, Severity level, State',16,122)
    ELSE
    SELECT @@Identity as NewOne


    Returns : NewOne
    NULL
    Have you hugged your backup today?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •