• John Hanrahan (11/19/2013)


    Sean,

    Here's the relevant code:

    ...

    Maybe my question should be isn't @@rowcount always one 1 in a trigger? You can see they use @numrows to do error checking? I guess it depends on the answer for @@rowcount.

    Thx.

    Absolutely not. In SQL server triggers DO NOT fire row by row. They respond to a statement, which in this case is an insert.

    I don't what datatypes of whatever are in this table but consider the following insert statement.

    insert timCustItem (LastPriceUOMKey)

    select 10 union all

    select 20

    Assuming that statement would be valid the inserted table would have 2 rows.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/