Home Forums SQL Server 2005 Development Main Store procedure to execute several store procedures or Trigger? RE: Main Store procedure to execute several store procedures or Trigger?

  • Jeff Moden (9/12/2009)


    You might also want to lookup what OUTPUT does for you, as well.

    Using the OUTPUT clause of the data modification statement is much to be preferred in many cases.

    Both SCOPE_IDENTITY() and @@IDENTITY are unreliable if a parallel plan was used in the statement that affected the IDENTITY column. I am unsure about whether IDENT_CURRENT is likewise unreliable in these circumstances.

    All four options (OUTPUT clause, @@IDENTITY, SCOPE_IDENTITY, and IDENT_CURRENT) have their applications, and all are well documented.

    When using anything except the OUTPUT clause, I am careful to add an explicit MAXDOP(1).

    See this confirmed bug for details. Both 2005 and 2008 are affected, and there are no plans to fix it before at least R2.

    Paul