Sql server

  • Hi everyone,

    I just want to know how many rows affected by triggering action (update command).

    Please help me it's urgent.

    Thanks in advance

  • viko172000 (11/2/2009)


    Hi everyone,

    I just want to know how many rows affected by triggering action (update command).

    Please help me it's urgent.

    Thanks in advance

    Not sure what you mean, if the update has finished, you will see the count at the end, if it is multiple updates, you will see it as it is running. have you got set nocount on or what sort of update is running.

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

  • try

    select count(*) from inserted

  • thanks shanu for quick reply.

    suppose after some action my trigger updateTrigger fire and will update some table testTable.

    I just want to know how many rows of testTable affected by triggering action.

  • with triggering you have 3 options.

    insert

    delete

    update

    in case 2 above in writes data to a 'deleted' table.

    option 1 and 3 writes to 'inserted'. in essence an update is an insert after comparison.

    to answer your question the inserted table in your case will contain only rows affected. no need for a where clause

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply