TRIGGERS and @@IDENTITY

  • Hi,

    I have an SP sp_add_organization:

    INSERT INTO Organization( ..)

    VALUES(..)

    SELECT @@IDENTITY

    The problem is that Organization table has an INSERT Trigger that has

    another INSERT INTO pgd_Forums

    and that pgd_Forums has an IDENTITY field

    So sp_add_organization returns me

    not the IDENTITY from Organization table

    but instead from pgd_Forums

    Question:

    How do I get the IDENTITY value for

    Organization table?

    Thank you,

    Robert

  • Use SCOPE_IDENTITY instead of @@IDENTITY. Check out BOL for more info.

  • Thank you!

    Works perfectly!

    quote:


    Use SCOPE_IDENTITY instead of @@IDENTITY. Check out BOL for more info.


Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply