• jcb (11/19/2013)


    Question: a select count(1) from inserted ill return the number of inserted rows?

    just for the record: avoid triggers, they are evil.

    avoid to put business logic in the database, let the application to handle it in the appropriate layer.

    Just for the record and to emphasize what Gail has already posted, I strongly disagree with both notions.

    Poorly written triggers are evil... not all triggers.

    Putting certain types of business logic in the database ensures the business logic is carried out when actions are initiated through other means than the application. Sometimes the "appropriate layer" is actually the data layer.

    But triggers, cursors, denormalization and other DB tools are misused most of time by developers.

    Misuse by people not qualified to use the tools doesn't make the tools bad. A chain saw can cut your arm off but some know how to carve intricate works of art with one.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)