SQL statement run info in Stored Proc

  • When you run a sql statement, in Server Management Studio, it tells you how many rows and how long it took, how do you get a stored Proc to capture this info in the Job history?

    So if you have a Stored Proc that runs two statements: Select - into statement.. and an insert into statment.. it would log how long each took and how may rows each statement inserted.

  • dwilliscp (10/23/2012)


    When you run a sql statement, in Server Management Studio, it tells you how many rows and how long it took, how do you get a stored Proc to capture this info in the Job history?

    So if you have a Stored Proc that runs two statements: Select - into statement.. and an insert into statment.. it would log how long each took and how may rows each statement inserted.

    Look up @@RowCount in BOL for number of rows affected.

    For execution times, just capture getdate() before and after the statements are executed and do a quick calculation.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Ok, thanks... will do.

Viewing 3 posts - 1 through 2 (of 2 total)

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