Trace the SQL statements

  • hi,

    I want to trace the SQL statements that which are executed during the SP execution.

    Ex:

    exec sp1 param1

    If i run the above sp... i would like to know which tables are effected [inserted data/update data/deleted] with the sql statements as followed .

    Insert into emp select 1,'ad',3200

    update dept set dept='HR' where deptid=10

    please give me the solution....

    thanks in adv...

  • To capture individual statements, or batch calls, you can use a server-side trace. These are set up through the Profiler utility that comes with SQL Server. The specific event you're looking for is SQL:StmtCompleted.

    For details on setting up a server-side trace, look here[/url].

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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