Posted on 2007-08-08
Last Modified: 2008-02-01

Can anyone tell me or point me to any theory that using SCOPE_IDENTITY is isolated to the user who is performing the action, i.e. separate thread?. i.e. so If I call SCOPE_IDENTITY I will  get the value I require from the correct INSERT and not one that may have happened after my insert but before it executes the SCOPE_IDENTITY

Thanks in advance

Question by:REA_ANDREW
    LVL 142

    Accepted Solution

    yes, SCOPE_IDENTITY() is doing exactly that: it gives you the identity value of YOUR scope (and session).

    -> will give the same results, except if you have a trigger on the table that itself inserts to another table with identity
    -> will give the current identity of the table, ignoring the scope (so would give you the identity generated by other users eventually)

    LVL 20

    Author Comment

    excellent cheers.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    Via a live example, show how to setup several different housekeeping processes for a SQL Server.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now