Profiling Stored procedure completion. SP:completed

  • Hi,

    I am using SQL Server 200 (sp4) on Windows server 2003, can someone tells me what SP:completed & SQL:StmtCompleted events are used for?

    When I am profiling SQL server during load test I only get SP:Starting but no SP:completed event if I know that the procedure was executed successfully (insert were done)

     

     


    Kindest Regards,

    egpotus DBA

  • Are you using any filters?

  • I am filtering only on databaseID, when I run the following query

    SELECT

    left(cast(textdata AS varchar(4000)),charindex(' ',cast(textdata AS varchar(4000))) )AS ProcStoc,

    SUM(case WHEN EventClass IN (42) THEN 1 ELSE 0 END ) AS ' SP:Starting',

    SUM(case WHEN EventClass IN (43) THEN 1 ELSE 0 END ) AS ' SP:Completed'

    FROM

    dbo.LOAD_TEST_V_28_11_06

    WHERE

    TextData LIKE 'sp_[_]%'

    GROUP

    BY left(cast(textdata AS varchar(4000)),charindex(' ',cast(textdata AS varchar(4000))) )

    ORDER

    BY 2

    I get

    ProcStocSP:StartingSP:Completed
    spi_tCommand 

    83

    spw_SearchCustomerForManualInvoice 81

    spw_LoadUnload_ttourcics 1515

    spi_ttransp_CreateTransport 150

    spi_tmovemen_CreateMovementTruckLoadingUnloading 150


    Kindest Regards,

    egpotus DBA

  • I am assuming that you are using either a Profiler or a server trace which is writing the data to the the database table called: "dbo.LOAD_TEST_V_28_11_06 "

    In either case, when creating Profiler Trace, under Events tab, choose TSQL and then add SQL:StmtCompleted.

    Once trace is started, with this event chosen, you should get SQL:StmtCompleted events.

  • You are correct I am using a server trace and load data into LOAD_TEST_V_28_11_06 , what I cannot explain is why I have

    8 sp:started and only 3 sp:completed when calling spi_tCommand  stored procedure.

    This procedure insert records in a table and when I check the table 8 new records have been added so I should also have 8 sp:completed events in my trace, don't you think?


    Kindest Regards,

    egpotus DBA

  • That is true.  As far as I understand you should.

    1. Do you have another dataset to check this (another run of profiler trace)?  If so, check that and see if pattern is the same.

    2. 

    - Turn on profiler trace - don't log the output - just view it as it goes

    - Execute one of the faulty sps and see if the result is the same

     

    Also, do you issue a COMMIT statement after you perform an INSERT?

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

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