Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2010
    Posts
    5

    Unanswered: Tracing SQL statements and number of records affected

    Tracing SQL statements and number of records affected

    I need to find the number of rows affected for each query, when I fire set of queries

    For e.g.:
    Select top 10 * from Employee
    Insert into Employee1 Select * From Employee
    Update Employee1 Set Name = 'Jon' Where name = 'mic'

    RESULT:
    Select top 10 * FRom Employee
    10 rows affected
    Insert into Employee1 Select * From Employees
    50 rows affected
    Update Employee1 Set Name = 'Jon' Where name = 'mic'
    2 rows affected

    Need: I need to audit user Queries and don't have control on the queries. So i need to write a backend scriot to check (check like query and rows affected) for the multiple queries fired by set of user.
    Last edited by preethamg; 08-09-10 at 07:58. Reason: Better understanding

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    @@rowcount
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jun 2010
    Posts
    5
    Thanks for reply. But here is a catch. I need to audit user Queries and don't have control on them. So i need to write a backend scriot to check (check like query and rows affected) the multiple queries fired by set of user.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    The statement completed event trace returns row count data. However, this is not cost free and will put a load on the server. Ideally you won't be running this for long periods (sounds like you might be...). If so, I would run this server side and not via profiler.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Jun 2010
    Posts
    5
    How can it be handled on server side?

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Testimonial:
    pootle flump
    ur codings are working excelent.

  7. #7
    Join Date
    Jun 2010
    Posts
    5
    Thanks. Let me check Please let me know if we get any alternative solutions

  8. #8
    Join Date
    Jun 2010
    Posts
    5
    Thanks to all. Since we have trace files created in our databases, I extracted required info from it.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •