Home Forums SQL Server 2008 T-SQL (SS2K8) How does teh inserted and deleted created of triggers? RE: How does teh inserted and deleted created of triggers?

  • Just to make it clear:

    Q: If there is an update occurred on Employees, does it create an inserted table with 10 columns as well, having an exact column structure as the trigger's table, Employees?

    Yes, "inserted" and "deleted" tables have exactly the same column's structure as the table subjected to data modification. (There are some limitation for accessing columns of text, ntext and image datatypes...)

    Q: As mentioned in the above assume the table has 10 TRIGGERS, does SQL create a set of inerted and deleted logical tables per trigger, thus for 10 triggers on the same table, it should create 10 pairs of inserted and deleted logical tables?

    Only one "inserted" and one "deleted" table will be there for one table for a single data modification action (actually, even if you will have no triggers at all, these two internal temporary in-memory tables will be there anyway...)

    I guess BoL explains all well enough:

    http://msdn.microsoft.com/en-GB/library/ms191300(v=sql.105).aspx

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]